Commit c34ea91
authored
Rollup merge of rust-lang#65778 - bdonlan:stable_weak_count, r=dtolnay
Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`
* Original PR: rust-lang#56696
* Tracking issue: rust-lang#57977
Closes: rust-lang#57977
Supporting comments:
> Although these were added for testing, it is occasionally useful to have a way to probe optimistically for whether a weak pointer has become dangling, without actually taking the overhead of manipulating atomics. Are there any plans to stabilize this?
_Originally posted by @bdonlan in rust-lang#57977 (comment)
> Having this stabilized would help. Currently, the only way to check if a weak pointer has become dangling is to call `upgrade`, which is by far expensive.
_Originally posted by @glebpom in rust-lang#57977 (comment)
Not sure if stabilizing these warrants a full RFC, so throwing this out here as a start for now.
Note: per CONTRIBUTING.md, I ran the tidy checks, but they seem to be failing on unchanged files (primarily in `src/stdsimd`).4 files changed
+35
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1836 | 1836 | | |
1837 | 1837 | | |
1838 | 1838 | | |
1839 | | - | |
| 1839 | + | |
1840 | 1840 | | |
1841 | 1841 | | |
1842 | 1842 | | |
| |||
1847 | 1847 | | |
1848 | 1848 | | |
1849 | 1849 | | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
1857 | 1853 | | |
1858 | 1854 | | |
1859 | 1855 | | |
1860 | 1856 | | |
1861 | | - | |
| 1857 | + | |
1862 | 1858 | | |
1863 | | - | |
| 1859 | + | |
1864 | 1860 | | |
1865 | 1861 | | |
1866 | 1862 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
1529 | 1529 | | |
1530 | 1530 | | |
1531 | 1531 | | |
1532 | | - | |
| 1532 | + | |
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
| |||
1541 | 1541 | | |
1542 | 1542 | | |
1543 | 1543 | | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
| 1544 | + | |
| 1545 | + | |
1547 | 1546 | | |
1548 | 1547 | | |
1549 | 1548 | | |
| |||
1552 | 1551 | | |
1553 | 1552 | | |
1554 | 1553 | | |
1555 | | - | |
1556 | | - | |
1557 | | - | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
| 1554 | + | |
| 1555 | + | |
1561 | 1556 | | |
1562 | | - | |
1563 | 1557 | | |
| 1558 | + | |
1564 | 1559 | | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
1568 | | - | |
| 1560 | + | |
1569 | 1561 | | |
1570 | | - | |
1571 | | - | |
1572 | | - | |
1573 | | - | |
1574 | | - | |
1575 | | - | |
1576 | | - | |
1577 | | - | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1578 | 1568 | | |
1579 | | - | |
| 1569 | + | |
1580 | 1570 | | |
1581 | 1571 | | |
1582 | 1572 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
0 commit comments