This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +50
-1
lines changed
rustc_hir_analysis/src/check/generator_interior/drop_ranges Expand file tree Collapse file tree 4 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,10 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
198198
199199 // If the type being assigned needs dropped, then the mutation counts as a borrow
200200 // since it is essentially doing `Drop::drop(&mut x); x = new_value;`.
201+ //
202+ // FIXME(drop-tracking): We need to be more responsible about inference
203+ // variables here, since `needs_drop` is a "raw" type query, i.e. it
204+ // basically requires types to have been fully resolved.
201205 if assignee_place. place . base_ty . needs_drop ( self . tcx , self . param_env ) {
202206 self . places
203207 . borrowed
Original file line number Diff line number Diff line change @@ -2205,7 +2205,10 @@ impl<'tcx> Ty<'tcx> {
22052205 // These aren't even `Clone`
22062206 ty:: Str | ty:: Slice ( ..) | ty:: Foreign ( ..) | ty:: Dynamic ( ..) => false ,
22072207
2208- ty:: Int ( ..) | ty:: Uint ( ..) | ty:: Float ( ..) => true ,
2208+ ty:: Infer ( ty:: InferTy :: FloatVar ( _) | ty:: InferTy :: IntVar ( _) )
2209+ | ty:: Int ( ..)
2210+ | ty:: Uint ( ..)
2211+ | ty:: Float ( ..) => true ,
22092212
22102213 // The voldemort ZSTs are fine.
22112214 ty:: FnDef ( ..) => true ,
Original file line number Diff line number Diff line change 1+ // compile-flags: -Zdrop-tracking
2+
3+ #![ feature( generators, generator_trait) ]
4+
5+ use std:: ops:: Generator ;
6+ use std:: pin:: Pin ;
7+
8+ fn main ( ) {
9+ let mut a = 5 ;
10+ let mut b = || {
11+ let d = 6 ;
12+ yield ;
13+ _zzz ( ) ; // #break
14+ a = d;
15+ } ;
16+ Pin :: new ( & mut b) . resume ( ) ;
17+ //~^ ERROR this function takes 1 argument but 0 arguments were supplied
18+ // This type error is required to reproduce the ICE...
19+ }
20+
21+ fn _zzz ( ) {
22+ ( )
23+ }
Original file line number Diff line number Diff line change 1+ error[E0061]: this function takes 1 argument but 0 arguments were supplied
2+ --> $DIR/issue-102645.rs:16:22
3+ |
4+ LL | Pin::new(&mut b).resume();
5+ | ^^^^^^-- an argument of type `()` is missing
6+ |
7+ note: associated function defined here
8+ --> $SRC_DIR/core/src/ops/generator.rs:LL:COL
9+ |
10+ LL | fn resume(self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return>;
11+ | ^^^^^^
12+ help: provide the argument
13+ |
14+ LL | Pin::new(&mut b).resume(());
15+ | ~~~~
16+
17+ error: aborting due to previous error
18+
19+ For more information about this error, try `rustc --explain E0061`.
You can’t perform that action at this time.
0 commit comments