This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 4d11c3f
authored
Rollup merge of rust-lang#71107 - vorner:weak-into-raw-dangling, r=Amanieu
Address concerns of weak-into-raw
This should address the standing concerns in rust-lang#60728 (comment).
I've still left the ability to create a new dangling pointer from `null`, as I feel like this is the natural behaviour to expect, but I'm fine removing that too. I've modified the documentation to allow the `as_ptr` or `into_ptr` to return whatever garbage in case of a dangling pointer. I've also removed the guarantee to be able to do `from_raw(as_ptr)` from the documentation (but it would still work right now).
I've renamed the method and added implementations for `Rc`/`Arc`.
I've also tried if I can just „enable“ unsized types. I believe the current interface is compatible with them. But the inner implementation will be a bit challenging ‒ I can't use the `data_offset` as is used by `Rc` or `Arc` because it AFAIK „touches“ (creates a reference to) the live value of `T` ‒ and in case of `Weak`, it might be completely bogus or already dead ‒ so that would be UB.
`./x.py test tidy` is completely mad on my own system all over the code base :-(. I'll just hope it goes through CI, or will fix as necessary.
Is it OK if I ask @Amanieu for review, as the concerns are from you?
~r @Amanieu2 files changed
+80
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
572 | 597 | | |
573 | 598 | | |
574 | | - | |
575 | 599 | | |
576 | 600 | | |
577 | 601 | | |
| |||
1644 | 1668 | | |
1645 | 1669 | | |
1646 | 1670 | | |
1647 | | - | |
1648 | | - | |
| 1671 | + | |
| 1672 | + | |
1649 | 1673 | | |
1650 | 1674 | | |
1651 | 1675 | | |
| |||
1658 | 1682 | | |
1659 | 1683 | | |
1660 | 1684 | | |
1661 | | - | |
| 1685 | + | |
1662 | 1686 | | |
1663 | | - | |
| 1687 | + | |
1664 | 1688 | | |
1665 | 1689 | | |
1666 | | - | |
| 1690 | + | |
1667 | 1691 | | |
1668 | | - | |
| 1692 | + | |
1669 | 1693 | | |
1670 | 1694 | | |
1671 | 1695 | | |
1672 | 1696 | | |
1673 | | - | |
1674 | | - | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
1681 | | - | |
1682 | | - | |
1683 | | - | |
1684 | | - | |
1685 | | - | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
1686 | 1701 | | |
1687 | 1702 | | |
1688 | 1703 | | |
| |||
1691 | 1706 | | |
1692 | 1707 | | |
1693 | 1708 | | |
1694 | | - | |
| 1709 | + | |
1695 | 1710 | | |
1696 | 1711 | | |
1697 | 1712 | | |
| |||
1712 | 1727 | | |
1713 | 1728 | | |
1714 | 1729 | | |
1715 | | - | |
| 1730 | + | |
1716 | 1731 | | |
1717 | 1732 | | |
1718 | | - | |
| 1733 | + | |
1719 | 1734 | | |
1720 | 1735 | | |
1721 | 1736 | | |
| |||
1730 | 1745 | | |
1731 | 1746 | | |
1732 | 1747 | | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
| 1748 | + | |
| 1749 | + | |
1736 | 1750 | | |
1737 | 1751 | | |
1738 | 1752 | | |
| |||
1765 | 1779 | | |
1766 | 1780 | | |
1767 | 1781 | | |
1768 | | - | |
1769 | 1782 | | |
1770 | 1783 | | |
1771 | 1784 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
569 | 594 | | |
570 | 595 | | |
571 | | - | |
572 | 596 | | |
573 | 597 | | |
574 | 598 | | |
| |||
1340 | 1364 | | |
1341 | 1365 | | |
1342 | 1366 | | |
1343 | | - | |
1344 | | - | |
| 1367 | + | |
| 1368 | + | |
1345 | 1369 | | |
1346 | 1370 | | |
1347 | 1371 | | |
| |||
1354 | 1378 | | |
1355 | 1379 | | |
1356 | 1380 | | |
1357 | | - | |
| 1381 | + | |
1358 | 1382 | | |
1359 | | - | |
| 1383 | + | |
1360 | 1384 | | |
1361 | 1385 | | |
1362 | | - | |
| 1386 | + | |
1363 | 1387 | | |
1364 | | - | |
| 1388 | + | |
1365 | 1389 | | |
1366 | 1390 | | |
1367 | 1391 | | |
1368 | 1392 | | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
1382 | 1397 | | |
1383 | 1398 | | |
1384 | 1399 | | |
| |||
1387 | 1402 | | |
1388 | 1403 | | |
1389 | 1404 | | |
1390 | | - | |
| 1405 | + | |
1391 | 1406 | | |
1392 | 1407 | | |
1393 | 1408 | | |
| |||
1408 | 1423 | | |
1409 | 1424 | | |
1410 | 1425 | | |
1411 | | - | |
| 1426 | + | |
1412 | 1427 | | |
1413 | 1428 | | |
1414 | | - | |
| 1429 | + | |
1415 | 1430 | | |
1416 | 1431 | | |
1417 | 1432 | | |
| |||
1427 | 1442 | | |
1428 | 1443 | | |
1429 | 1444 | | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
| 1445 | + | |
| 1446 | + | |
1433 | 1447 | | |
1434 | 1448 | | |
1435 | 1449 | | |
| |||
1458 | 1472 | | |
1459 | 1473 | | |
1460 | 1474 | | |
1461 | | - | |
1462 | 1475 | | |
1463 | 1476 | | |
1464 | 1477 | | |
| |||
0 commit comments