about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2019-07-05 19:10:29 -0400
committerAaron Hill <aa1ronham@gmail.com>2019-07-07 17:22:07 -0400
commit36008327cc3214afaf5ce5bacdf2fdf236422caf (patch)
tree2ba7fe18af0695272651e5d5a2a596eacc2755a5
parent2ab8d618823a51f347407cf7299110ad42f26616 (diff)
downloadrust-36008327cc3214afaf5ce5bacdf2fdf236422caf.tar.gz
rust-36008327cc3214afaf5ce5bacdf2fdf236422caf.zip
Address review comments
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/mod.rs6
-rw-r--r--src/librustc_typeck/check/writeback.rs5
-rw-r--r--src/test/ui/existential_types/existential_type_const.rs (renamed from src/test/run-pass/existential_type_const.rs)2
-rw-r--r--src/test/ui/existential_types/existential_type_const.stderr (renamed from src/test/run-pass/existential_type_const.stderr)0
-rw-r--r--src/test/ui/existential_types/existential_type_fns.rs (renamed from src/test/run-pass/existential_type_fns.rs)2
-rw-r--r--src/test/ui/existential_types/existential_type_tuple.rs (renamed from src/test/run-pass/existential_type_tuple.rs)3
6 files changed, 14 insertions, 4 deletions
diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
index a505750b1a1..1194872c0af 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
@@ -1280,14 +1280,14 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                             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
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 14bd2f0fa7e..831f9daa52d 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -587,6 +587,11 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
             }
 
             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,
diff --git a/src/test/run-pass/existential_type_const.rs b/src/test/ui/existential_types/existential_type_const.rs
index 1f80475cb77..55920b85dd7 100644
--- a/src/test/run-pass/existential_type_const.rs
+++ b/src/test/ui/existential_types/existential_type_const.rs
@@ -1,3 +1,5 @@
+// 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
diff --git a/src/test/run-pass/existential_type_const.stderr b/src/test/ui/existential_types/existential_type_const.stderr
index b6d83fb1703..b6d83fb1703 100644
--- a/src/test/run-pass/existential_type_const.stderr
+++ b/src/test/ui/existential_types/existential_type_const.stderr
diff --git a/src/test/run-pass/existential_type_fns.rs b/src/test/ui/existential_types/existential_type_fns.rs
index e477dca9aad..6f22eef2849 100644
--- a/src/test/run-pass/existential_type_fns.rs
+++ b/src/test/ui/existential_types/existential_type_fns.rs
@@ -1,3 +1,5 @@
+// check-pass
+
 #![feature(existential_type)]
 
 // Regression test for issue #61863
diff --git a/src/test/run-pass/existential_type_tuple.rs b/src/test/ui/existential_types/existential_type_tuple.rs
index 31c145ea89a..0f134a52897 100644
--- a/src/test/run-pass/existential_type_tuple.rs
+++ b/src/test/ui/existential_types/existential_type_tuple.rs
@@ -1,5 +1,6 @@
-#![feature(existential_type)]
+// check-pass
 
+#![feature(existential_type)]
 #![allow(dead_code)]
 
 pub trait MyTrait {}