Skip to content

Tracking Issue for removing unsized_locals #111942

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
2 tasks
Noratrieb opened this issue May 25, 2023 · 2 comments
Open
2 tasks

Tracking Issue for removing unsized_locals #111942

Noratrieb opened this issue May 25, 2023 · 2 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-unsized_locals `#![feature(unsized_locals)]` S-tracking-remove-implementation Status: The feature needs to be removed from the Rust toolchain before this issue can be closed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Noratrieb
Copy link
Member

This is a tracking issue for the MCP "630" (rust-lang/compiler-team#630).
The feature gate for the issue is #![feature(unsized_locals)].

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

  • Implement the MCP (cc @rust-lang/compiler-contributors -- can anyone write up mentoring
    instructions?)
  • Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])

Implementation history

@Noratrieb Noratrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-unsized_locals `#![feature(unsized_locals)]` labels May 25, 2023
@Jules-Bertholet
Copy link
Contributor

Jules-Bertholet commented May 25, 2023

It seems strange to see this happen so soon after the major soundness issue with this feature was fixed (#111374).

@RalfJung
Copy link
Member

RalfJung commented Aug 6, 2023

FWIW, in #114483 I managed to find a nice way to unify the handling of sized and unsized function parameters. However, unsized locals still don't work.

Fundamentally, the problem is that StorageLive should allocate the memory for a local -- but for unsized locals, it cannot know how much memory that is. The new primitive that helped in #114483 is a storage_live_dyn that is given pointer metadata to compute the size for dynamically sized types. So I think to add unsized locals to MIR in a proper way, we'd want to extend StorageLive with an (optional) parameter that indicates another, existing place that has the same type as the local, and whose metadata is used for the assignment.

The source-level assignment x = y; could then be compiled to

StorageLive(x, y);
x = y;

and that would be a coherent way to represent dynamically sized locals in MIR without weird hacks like we needed them in the past.

In LLVM codegen, the StorageLive would compile to an alloca; assignment could be a regular memcpy (but needs to compute the dynamic size of course).

@jieyouxu jieyouxu added the S-tracking-remove-implementation Status: The feature needs to be removed from the Rust toolchain before this issue can be closed label Mar 23, 2025
jhpratt added a commit to jhpratt/rust that referenced this issue Jun 14, 2025
Unimplement unsized_locals

Implements rust-lang/compiler-team#630

Tracking issue here: rust-lang#111942

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc `@JakobDegen` `@oli-obk` `@Noratrieb` `@programmerjake` `@bjorn3`

`@rustbot` label F-unsized_locals

Fixes rust-lang#79409
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 14, 2025
Unimplement unsized_locals

Implements rust-lang/compiler-team#630

Tracking issue here: rust-lang#111942

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``

``@rustbot`` label F-unsized_locals

Fixes rust-lang#79409
rust-timer added a commit that referenced this issue Jun 14, 2025
Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errors

Unimplement unsized_locals

Implements rust-lang/compiler-team#630

Tracking issue here: #111942

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``

``@rustbot`` label F-unsized_locals

Fixes #79409
RalfJung pushed a commit to RalfJung/miri that referenced this issue Jun 15, 2025
Unimplement unsized_locals

Implements rust-lang/compiler-team#630

Tracking issue here: rust-lang/rust#111942

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``

``@rustbot`` label F-unsized_locals

Fixes rust-lang/rust#79409
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this issue Jun 16, 2025
Unimplement unsized_locals

Implements rust-lang/compiler-team#630

Tracking issue here: rust-lang/rust#111942

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``

``@rustbot`` label F-unsized_locals

Fixes rust-lang/rust#79409
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this issue Jun 16, 2025
Unimplement unsized_locals

Implements rust-lang/compiler-team#630

Tracking issue here: rust-lang/rust#111942

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``

``@rustbot`` label F-unsized_locals

Fixes rust-lang/rust#79409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-unsized_locals `#![feature(unsized_locals)]` S-tracking-remove-implementation Status: The feature needs to be removed from the Rust toolchain before this issue can be closed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants