@@ -2249,16 +2249,23 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
2249
2249
}
2250
2250
2251
2251
fn closure_contents ( cty : & ClosureTy ) -> TypeContents {
2252
+ // Closure contents are just like trait contents, but with potentially
2253
+ // even more stuff.
2252
2254
let st = match cty. sigil {
2253
- ast:: BorrowedSigil => TC_BORROWED_POINTER ,
2254
- ast :: ManagedSigil => TC_MANAGED ,
2255
- ast :: OwnedSigil => if cty . bounds . contains_elem ( BoundCopy ) {
2256
- TC_OWNED_POINTER
2257
- } else {
2258
- TC_OWNED_POINTER + TC_NONCOPY_TRAIT
2259
- }
2255
+ ast:: BorrowedSigil =>
2256
+ trait_contents ( RegionTraitStore ( cty . region ) , m_imm , cty . bounds )
2257
+ + TC_BORROWED_POINTER , // might be an env packet even if static
2258
+ ast :: ManagedSigil =>
2259
+ trait_contents ( BoxTraitStore , m_imm , cty . bounds ) ,
2260
+ ast :: OwnedSigil =>
2261
+ trait_contents ( UniqTraitStore , m_imm , cty . bounds ) ,
2260
2262
} ;
2263
+ // FIXME(#3569): This borrowed_contents call should be taken care of in
2264
+ // trait_contents, after ~Traits and @Traits can have region bounds too.
2265
+ // This one here is redundant for &fns but important for ~fns and @fns.
2261
2266
let rt = borrowed_contents ( cty. region , m_imm) ;
2267
+ // This also prohibits "@once fn" from being copied, which allows it to
2268
+ // be called. Neither way really makes much sense.
2262
2269
let ot = match cty. onceness {
2263
2270
ast:: Once => TC_ONCE_CLOSURE ,
2264
2271
ast:: Many => TC_NONE
0 commit comments