Skip to content

Commit 937b1fb

Browse files
committed
---
yaml --- r: 66310 b: refs/heads/master c: f8c892a h: refs/heads/master v: v3
1 parent b292942 commit 937b1fb

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 108739f533efd1a4faca62db1afb611f22c5f5f2
2+
refs/heads/master: f8c892ab966e37c7fb8936ace6c7d40c8642f6ab
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/librustc/middle/ty.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,16 +2249,23 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
22492249
}
22502250

22512251
fn closure_contents(cty: &ClosureTy) -> TypeContents {
2252+
// Closure contents are just like trait contents, but with potentially
2253+
// even more stuff.
22522254
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),
22602262
};
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.
22612266
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.
22622269
let ot = match cty.onceness {
22632270
ast::Once => TC_ONCE_CLOSURE,
22642271
ast::Many => TC_NONE

0 commit comments

Comments
 (0)