Skip to content

Commit 3600832

Browse files
committed
Address review comments
1 parent 2ab8d61 commit 3600832

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

src/librustc_mir/borrow_check/nll/type_check/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1280,14 +1280,14 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12801280
concrete_is_opaque
12811281
);
12821282

1283-
// concrete_is_opaque is 'true' when we're using an existential
1284-
// type without 'revelaing' it. For example, code like this:
1283+
// concrete_is_opaque is `true` when we're using an existential
1284+
// type without 'revealing' it. For example, code like this:
12851285
//
12861286
// existential type Foo: Debug;
12871287
// fn foo1() -> Foo { ... }
12881288
// fn foo2() -> Foo { foo1() }
12891289
//
1290-
// In 'foo2', we're not revealing the type of 'Foo' - we're
1290+
// In `foo2`, we're not revealing the type of `Foo` - we're
12911291
// just treating it as the opaque type.
12921292
//
12931293
// When this occurs, we do *not* want to try to equate

src/librustc_typeck/check/writeback.rs

+5
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,11 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
587587
}
588588

589589
if !opaque_defn.substs.has_local_value() {
590+
// We only want to add an entry into `concrete_existential_types`
591+
// if we actually found a defining usage of this existential type.
592+
// Otherwise, we do nothing - we'll either find a defining usage
593+
// in some other location, or we'll end up emitting an error due
594+
// to the lack of defining usage
590595
if !skip_add {
591596
let new = ty::ResolvedOpaqueTy {
592597
concrete_type: definition_ty,

src/test/run-pass/existential_type_const.rs renamed to src/test/ui/existential_types/existential_type_const.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// check-pass
2+
13
#![feature(existential_type)]
24
#![feature(impl_trait_in_bindings)]
35
//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash

src/test/run-pass/existential_type_fns.rs renamed to src/test/ui/existential_types/existential_type_fns.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// check-pass
2+
13
#![feature(existential_type)]
24

35
// Regression test for issue #61863

src/test/run-pass/existential_type_tuple.rs renamed to src/test/ui/existential_types/existential_type_tuple.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#![feature(existential_type)]
1+
// check-pass
22

3+
#![feature(existential_type)]
34
#![allow(dead_code)]
45

56
pub trait MyTrait {}

0 commit comments

Comments
 (0)