Skip to content

[macros] Support shrinking reference transmutes #2487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b
Choose a base branch
from

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Apr 7, 2025

In transmute_ref! and transmute_mut!, support an #![allow(shrink)]
attribute which is invoked as follows:

transmute_ref!(#![allow(shrink)] src);

When this attribute is provided, the macros will permit shrinking
transmutes, in which the destination value may be smaller than the
source value.

Makes progress on #1817

Co-authored-by: Jack Wrenn [email protected]


This PR is on branch transmute-ref-dst.

@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 7e3c9df to cc7b98d Compare April 7, 2025 23:23
@joshlf joshlf force-pushed the I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 branch from eec3ec9 to bafb400 Compare April 7, 2025 23:35
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch 3 times, most recently from 149d455 to f0a9dcf Compare April 7, 2025 23:56
@joshlf joshlf force-pushed the I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 branch from bafb400 to 0386dc9 Compare June 3, 2025 19:13
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from f0a9dcf to 8515ac1 Compare June 3, 2025 19:13
@joshlf joshlf force-pushed the I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 branch from 0386dc9 to 8793f97 Compare June 3, 2025 19:53
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch 2 times, most recently from 5a78ea6 to a1883ff Compare June 4, 2025 15:40
@joshlf joshlf force-pushed the I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 branch from 8793f97 to 491b473 Compare June 4, 2025 15:40
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from a1883ff to 9d89a72 Compare June 4, 2025 16:01
@joshlf joshlf force-pushed the I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 branch 2 times, most recently from 0e678af to ed98af3 Compare June 4, 2025 16:39
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 9d89a72 to 681bec1 Compare June 4, 2025 16:39
@joshlf joshlf force-pushed the I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 branch from ed98af3 to f9e4d83 Compare June 4, 2025 18:28
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 681bec1 to 56f691c Compare June 4, 2025 18:28
@joshlf joshlf force-pushed the I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 branch from f9e4d83 to a7bb504 Compare June 4, 2025 19:41
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch 2 times, most recently from 2beca4e to d8ed221 Compare June 4, 2025 19:53
@joshlf joshlf changed the base branch from I32ffeea758b53073aa461ab41c217e5b8f0bc4e4 to I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b June 4, 2025 19:53
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from 97e2096 to 20f0bc3 Compare June 5, 2025 20:09
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from d8ed221 to 9c78c59 Compare June 5, 2025 20:09
@joshlf joshlf changed the base branch from I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b to I1e15473bf871e5b53a6c093e6a79f48e6498aa04 June 5, 2025 20:09
@joshlf joshlf force-pushed the I1e15473bf871e5b53a6c093e6a79f48e6498aa04 branch from feb1f37 to a2f2308 Compare June 6, 2025 16:24
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from 5d699c7 to 7565c70 Compare June 9, 2025 18:15
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 260e2e3 to 184dbb5 Compare June 9, 2025 18:15
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from 7565c70 to 31b5471 Compare June 9, 2025 18:22
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch 2 times, most recently from 18a049a to cd0c968 Compare June 9, 2025 18:43
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from 31b5471 to 291b87b Compare June 9, 2025 18:43
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from cd0c968 to 10e1604 Compare June 9, 2025 19:11
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from 291b87b to 9b25166 Compare June 9, 2025 19:11
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 10e1604 to d494109 Compare June 9, 2025 19:12
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch 2 times, most recently from 3d8da5b to 88213f3 Compare June 9, 2025 19:18
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from d494109 to 67b20da Compare June 9, 2025 19:18
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 67b20da to 52f78f3 Compare June 9, 2025 19:20
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch 2 times, most recently from e430a16 to 4abed50 Compare June 9, 2025 19:30
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch 2 times, most recently from 10ae313 to fe7ab51 Compare June 9, 2025 20:13
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from 4abed50 to 7e1bf34 Compare June 9, 2025 20:13
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from fe7ab51 to a0e259a Compare June 9, 2025 20:16
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch 2 times, most recently from d3aad92 to 9fda82b Compare June 9, 2025 23:11
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from a0e259a to 91eb2e0 Compare June 9, 2025 23:11
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from 9fda82b to eef2e15 Compare June 9, 2025 23:11
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 91eb2e0 to 24b1350 Compare June 9, 2025 23:11
In `transmute_ref!` and `transmute_mut!`, support an `#![allow(shrink)]`
attribute which is invoked as follows:

  transmute_ref!(#![allow(shrink)] src);

When this attribute is provided, the macros will permit shrinking
transmutes, in which the destination value may be smaller than the
source value.

Makes progress on #1817

Co-authored-by: Jack Wrenn <[email protected]>
gherrit-pr-id: I10874e2bc703fb6b7fcdea050b8971de869a850a
@joshlf joshlf force-pushed the I10874e2bc703fb6b7fcdea050b8971de869a850a branch from 24b1350 to a6c1b4c Compare June 10, 2025 13:12
@joshlf joshlf force-pushed the I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b branch from eef2e15 to 3fc3abf Compare June 10, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant