Skip to content

Commit 398a5f8

Browse files
committed
Ignore existential type items during collection for now
1 parent 356d683 commit 398a5f8

File tree

3 files changed

+10
-50
lines changed

3 files changed

+10
-50
lines changed

src/librustc_typeck/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
419419
convert_variant_ctor(tcx, struct_def.id());
420420
}
421421
},
422-
hir::ItemExistential(..) |
422+
hir::ItemExistential(..) => {}
423423
hir::ItemTy(..) | hir::ItemStatic(..) | hir::ItemConst(..) | hir::ItemFn(..) => {
424424
tcx.generics_of(def_id);
425425
tcx.type_of(def_id);

src/test/ui/impl-trait/auto-trait-leak.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ fn main() {
2323
// return type, which can't depend on the obligation.
2424
fn cycle1() -> impl Clone {
2525
//~^ ERROR cycle detected
26-
//~| ERROR cycle detected
2726
send(cycle2().clone());
28-
//~^ ERROR `std::rc::Rc<std::string::String>` cannot be sent between threads safely
2927

3028
Rc::new(Cell::new(5))
3129
}
Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,29 @@
1-
error[E0391]: cycle detected when processing `cycle1::{{impl-Trait}}`
2-
--> $DIR/auto-trait-leak.rs:24:16
3-
|
4-
LL | fn cycle1() -> impl Clone {
5-
| ^^^^^^^^^^
6-
|
7-
note: ...which requires processing `cycle1`...
1+
error[E0391]: cycle detected when processing `cycle1`
82
--> $DIR/auto-trait-leak.rs:24:1
93
|
104
LL | fn cycle1() -> impl Clone {
115
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
127
note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
138
note: ...which requires processing `cycle2::{{impl-Trait}}`...
14-
--> $DIR/auto-trait-leak.rs:33:16
9+
--> $DIR/auto-trait-leak.rs:31:16
1510
|
1611
LL | fn cycle2() -> impl Clone {
1712
| ^^^^^^^^^^
1813
note: ...which requires processing `cycle2`...
19-
--> $DIR/auto-trait-leak.rs:33:1
14+
--> $DIR/auto-trait-leak.rs:31:1
2015
|
2116
LL | fn cycle2() -> impl Clone {
2217
| ^^^^^^^^^^^^^^^^^^^^^^^^^
2318
note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
24-
= note: ...which again requires processing `cycle1::{{impl-Trait}}`, completing the cycle
25-
26-
error[E0391]: cycle detected when processing `cycle1::{{impl-Trait}}`
19+
note: ...which requires processing `cycle1::{{impl-Trait}}`...
2720
--> $DIR/auto-trait-leak.rs:24:16
2821
|
2922
LL | fn cycle1() -> impl Clone {
3023
| ^^^^^^^^^^
31-
|
32-
note: ...which requires processing `cycle1`...
33-
--> $DIR/auto-trait-leak.rs:24:1
34-
|
35-
LL | fn cycle1() -> impl Clone {
36-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
37-
note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
38-
note: ...which requires processing `cycle2::{{impl-Trait}}`...
39-
--> $DIR/auto-trait-leak.rs:33:16
40-
|
41-
LL | fn cycle2() -> impl Clone {
42-
| ^^^^^^^^^^
43-
note: ...which requires processing `cycle2`...
44-
--> $DIR/auto-trait-leak.rs:33:1
45-
|
46-
LL | fn cycle2() -> impl Clone {
47-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48-
= note: ...which again requires processing `cycle1::{{impl-Trait}}`, completing the cycle
49-
50-
error[E0277]: `std::rc::Rc<std::string::String>` cannot be sent between threads safely
51-
--> $DIR/auto-trait-leak.rs:27:5
52-
|
53-
LL | send(cycle2().clone());
54-
| ^^^^ `std::rc::Rc<std::string::String>` cannot be sent between threads safely
55-
|
56-
= help: within `impl std::clone::Clone`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::string::String>`
57-
= note: required because it appears within the type `impl std::clone::Clone`
58-
note: required by `send`
59-
--> $DIR/auto-trait-leak.rs:16:1
60-
|
61-
LL | fn send<T: Send>(_: T) {}
62-
| ^^^^^^^^^^^^^^^^^^^^^^
24+
= note: ...which again requires processing `cycle1`, completing the cycle
25+
note: cycle used when type-checking all item bodies
6326

64-
error: aborting due to 3 previous errors
27+
error: aborting due to previous error
6528

66-
Some errors occurred: E0277, E0391.
67-
For more information about an error, try `rustc --explain E0277`.
29+
For more information about this error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)