Skip to content

Conversation

@m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Mar 29, 2025

Tracking issue for super let: #139076

This uses super let to implement pin!().

This means we can remove the hack we had to put in to fix #138596.

It also means we can remove the original hack to make pin!() work, which used a questionable public-but-unstable field rather than a proper private field.

While super let is still unstable and subject to change, it seems safe to assume that future Rust will always have a way to express pin!() in a compatible way, considering pin!() is already stable.

It'd help the experiment to have pin!() use super let, so we can get some more experience with it.

@m-ou-se m-ou-se self-assigned this Mar 29, 2025
@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 29, 2025
@m-ou-se m-ou-se mentioned this pull request Mar 29, 2025
29 tasks
@m-ou-se m-ou-se removed the PG-exploit-mitigations Project group: Exploit mitigations label Mar 29, 2025
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Mar 29, 2025
@m-ou-se m-ou-se removed the PG-exploit-mitigations Project group: Exploit mitigations label Mar 29, 2025
@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Mar 30, 2025
@m-ou-se m-ou-se removed the PG-exploit-mitigations Project group: Exploit mitigations label Mar 30, 2025
@bors
Copy link
Collaborator

bors commented Apr 1, 2025

☔ The latest upstream changes (presumably #138740) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Apr 9, 2025
@m-ou-se m-ou-se removed the PG-exploit-mitigations Project group: Exploit mitigations label Apr 9, 2025
@m-ou-se m-ou-se marked this pull request as ready for review April 9, 2025 13:08
@rustbot

This comment was marked as outdated.

@m-ou-se
Copy link
Member Author

m-ou-se commented Apr 9, 2025

r? compiler

@rustbot rustbot assigned davidtwco and unassigned m-ou-se Apr 9, 2025
@bors

This comment was marked as outdated.

@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Apr 10, 2025
@m-ou-se m-ou-se removed the PG-exploit-mitigations Project group: Exploit mitigations label Apr 10, 2025
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 19, 2025
@bors
Copy link
Collaborator

bors commented Apr 19, 2025

⌛ Testing commit 5523c87 with merge a7c39b6...

@bors
Copy link
Collaborator

bors commented Apr 19, 2025

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing a7c39b6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 19, 2025
@bors bors merged commit a7c39b6 into rust-lang:master Apr 19, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 19, 2025
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 2ef7858 (parent) -> a7c39b6 (this PR)

Test differences

Show 49 test diffs

Stage 0

  • pin_macro::temp_lifetime: pass -> [missing] (J1)

Stage 1

  • [ui] tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs: pass -> [missing] (J2)
  • [ui] tests/ui/pin-macro/cant_access_internals.rs: pass -> [missing] (J2)

Stage 2

  • [ui] tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs: pass -> [missing] (J0)
  • [ui] tests/ui/pin-macro/cant_access_internals.rs: pass -> [missing] (J0)

Additionally, 44 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Job duration changes

  1. dist-aarch64-linux: 5282.2s -> 7591.8s (43.7%)
  2. x86_64-apple-1: 8265.6s -> 6235.6s (-24.6%)
  3. dist-x86_64-apple: 10601.5s -> 8293.5s (-21.8%)
  4. x86_64-apple-2: 4845.3s -> 5766.6s (19.0%)
  5. aarch64-apple: 3980.0s -> 3698.9s (-7.1%)
  6. dist-ohos: 10661.5s -> 9945.9s (-6.7%)
  7. dist-armv7-linux: 5781.1s -> 5413.6s (-6.4%)
  8. dist-apple-various: 6128.4s -> 6504.5s (6.1%)
  9. dist-x86_64-freebsd: 5136.0s -> 4879.8s (-5.0%)
  10. dist-i686-linux: 5826.9s -> 6109.6s (4.9%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@bors bors mentioned this pull request Apr 19, 2025
3 tasks
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a7c39b6): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.5%, secondary -2.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.2% [0.4%, 2.0%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.8% [-2.2%, -0.4%] 14
Improvements ✅
(secondary)
-2.7% [-3.3%, -2.3%] 5
All ❌✅ (primary) -0.5% [-2.2%, 2.0%] 16

Cycles

Results (primary -0.6%, secondary -2.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.8%, -0.4%] 15
Improvements ✅
(secondary)
-2.9% [-3.4%, -2.0%] 8
All ❌✅ (primary) -0.6% [-0.8%, -0.4%] 15

Binary size

Results (primary 0.0%, secondary 0.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 3
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 3

Bootstrap: 774.105s -> 772.535s (-0.20%)
Artifact size: 365.05 MiB -> 364.98 MiB (-0.02%)

ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 20, 2025
…Urgau

Remove (now unused) #[rustc_macro_edition_2021] attribute

Now that rust-lang#139114 has been merged, we no longer need the temporary hack (`#[rustc_macro_edition_2021]`) that we introduced in rust-lang#138717. Time to remove it.
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 20, 2025
…Urgau

Remove (now unused) #[rustc_macro_edition_2021] attribute

Now that rust-lang#139114 has been merged, we no longer need the temporary hack (`#[rustc_macro_edition_2021]`) that we introduced in rust-lang#138717. Time to remove it.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 20, 2025
Rollup merge of rust-lang#140067 - m-ou-se:remove-macro-2021-hack, r=Urgau

Remove (now unused) #[rustc_macro_edition_2021] attribute

Now that rust-lang#139114 has been merged, we no longer need the temporary hack (`#[rustc_macro_edition_2021]`) that we introduced in rust-lang#138717. Time to remove it.
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 22, 2025
Implement `pin!()` using `super let`

Tracking issue for super let: rust-lang#139076

This uses `super let` to implement `pin!()`.

This means we can remove [the hack](rust-lang#138717) we had to put in to fix rust-lang#138596.

It also means we can remove the original hack to make `pin!()` work, which used a questionable public-but-unstable field rather than a proper private field.

While `super let` is still unstable and subject to change, it seems safe to assume that future Rust will always have a way to express `pin!()` in a compatible way, considering `pin!()` is already stable.

It'd help [the experiment](rust-lang#139076) to have `pin!()` use `super let`, so we can get some more experience with it.
@m-ou-se m-ou-se deleted the super-let-pin branch April 22, 2025 14:12
bors added a commit to rust-lang-ci/rust that referenced this pull request May 7, 2025
 Allow storing format_args!() in variable

Fixes rust-lang#92698

Tracking issue for super let: rust-lang#139076

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!");

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this. (This was also the motivation for merging rust-lang#139114.)

> [!NOTE]
> This PR causes many subtle changes in diagnostics output. Most of those are good. Some of those are bad. I've collected all the bad ones in the last commit. Those still need fixing. Marking this PR as draft.

(This is a second version of rust-lang#139135)
bors added a commit that referenced this pull request Jun 19, 2025
 Allow storing `format_args!()` in variable

Fixes #92698

Tracking issue for super let: #139076

Tracking issue for format_args: #99012

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!"); // New: Store format_args!() for later!

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging #139114.)

(This is a second version of #139135)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 20, 2025
 Allow storing `format_args!()` in variable

Fixes rust-lang/rust#92698

Tracking issue for super let: rust-lang/rust#139076

Tracking issue for format_args: rust-lang/rust#99012

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!"); // New: Store format_args!() for later!

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging rust-lang/rust#139114.)

(This is a second version of rust-lang/rust#139135)
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jun 23, 2025
 Allow storing `format_args!()` in variable

Fixes rust-lang/rust#92698

Tracking issue for super let: rust-lang/rust#139076

Tracking issue for format_args: rust-lang/rust#99012

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!"); // New: Store format_args!() for later!

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging rust-lang/rust#139114.)

(This is a second version of rust-lang/rust#139135)
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Jun 26, 2025
 Allow storing `format_args!()` in variable

Fixes rust-lang/rust#92698

Tracking issue for super let: rust-lang/rust#139076

Tracking issue for format_args: rust-lang/rust#99012

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!"); // New: Store format_args!() for later!

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging rust-lang/rust#139114.)

(This is a second version of rust-lang/rust#139135)
tautschnig pushed a commit to model-checking/verify-rust-std that referenced this pull request Jul 3, 2025
…elmann

 Allow storing `format_args!()` in variable

Fixes rust-lang#92698

Tracking issue for super let: rust-lang#139076

Tracking issue for format_args: rust-lang#99012

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!"); // New: Store format_args!() for later!

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging rust-lang#139114.)

(This is a second version of rust-lang#139135)
Boshen pushed a commit to Boshen/cargo-shear that referenced this pull request Nov 26, 2025
Trying to run `cargo shear --expand` on the majority of Rust 1.88+
projects will fail due to the use of `super let` by the `pin!` macro on
nightly, which `syn` can't parse:
rust-lang/rust#139114

`syn` won't add support for parsing `super let` until it's closer to
stabilization: dtolnay/syn#1947

So I opted to switch to rust-analyzer's syntax parser instead. The API
is pretty similar overall. Main benefit is it supports more experimental
syntax. Though I'm not sure how stable it is, which might be a concern.

It's a more resilient parser, so it handles syntax errors gracefully.
That might backfire in certain scenarios.

With these changes, I was able to run `--expand` against the Zed
monorepo, which found 100+ issues.

<details>

```bash
Analyzing /home/cmullan/workspace/zed

acp_thread -- crates/acp_thread/Cargo.toml:
  unused dependencies:
    zlog
    tempfile

acp_tools -- crates/acp_tools/Cargo.toml:
  unused dependencies:
    serde

action_log -- crates/action_log/Cargo.toml:
  unused dependencies:
    indoc

agent -- crates/agent/Cargo.toml:
  unused dependencies:
    editor
    terminal
    worktree

agent_servers -- crates/agent_servers/Cargo.toml:
  unused dependencies:
    nix
    libc
    language

agent_settings -- crates/agent_settings/Cargo.toml:
  unused dependencies:
    serde_json_lenient
    serde_json
    paths

ai_onboarding -- crates/ai_onboarding/Cargo.toml:
  unused dependencies:
    serde

assistant_text_thread -- crates/assistant_text_thread/Cargo.toml:
  unused dependencies:
    indoc

audio -- crates/audio/Cargo.toml:
  unused dependencies:
    serde

buffer_diff -- crates/buffer_diff/Cargo.toml:
  unused dependencies:
    serde_json

call -- crates/call/Cargo.toml:
  unused dependencies:
    http_client
    serde

client -- crates/client/Cargo.toml:
  unused dependencies:
    fs

collab -- crates/collab/Cargo.toml:
  unused dependencies:
    context_server
    dap-types
    sea-orm-macros
    agent_settings
    hyper
    audio
    multi_buffer

collab_ui -- crates/collab_ui/Cargo.toml:
  unused dependencies:
    pretty_assertions
    tree-sitter-md

command_palette -- crates/command_palette/Cargo.toml:
  unused dependencies:
    env_logger
    serde_json
    ctor

copilot -- crates/copilot/Cargo.toml:
  unused dependencies:
    async-std
    clock
    client
    task

credentials_provider -- crates/credentials_provider/Cargo.toml:
  unused dependencies:
    serde

dap -- crates/dap/Cargo.toml:
  unused dependencies:
    tree-sitter
    tree-sitter-go

dap_adapters -- crates/dap_adapters/Cargo.toml:
  unused dependencies:
    serde

diagnostics -- crates/diagnostics/Cargo.toml:
  unused dependencies:
    serde
    client
    component

edit_prediction_button -- crates/edit_prediction_button/Cargo.toml:
  unused dependencies:
    theme
    lsp
    serde_json
    futures

edit_prediction_context -- crates/edit_prediction_context/Cargo.toml:
  unused dependencies:
    clap

editor -- crates/editor/Cargo.toml:
  unused dependencies:
    http_client
    tempfile

extension_cli -- crates/extension_cli/Cargo.toml:
  unused dependencies:
    serde

extensions_ui -- crates/extensions_ui/Cargo.toml:
  unused dependencies:
    serde

feedback -- crates/feedback/Cargo.toml:
  unused dependencies:
    editor

file_finder -- crates/file_finder/Cargo.toml:
  unused dependencies:
    language

file_icons -- crates/file_icons/Cargo.toml:
  unused dependencies:
    serde

git -- crates/git/Cargo.toml:
  unused dependencies:
    unindent

git_ui -- crates/git_ui/Cargo.toml:
  unused dependencies:
    windows

go_to_line -- crates/go_to_line/Cargo.toml:
  unused dependencies:
    tree-sitter-typescript
    serde
    tree-sitter-rust

gpui -- crates/gpui/Cargo.toml:
  unused dependencies:
    cocoa-foundation
    x11-clipboard
    pretty_assertions

image_viewer -- crates/image_viewer/Cargo.toml:
  unused dependencies:
    serde

journal -- crates/journal/Cargo.toml:
  unused dependencies:
    serde

json_schema_store -- crates/json_schema_store/Cargo.toml:
  unused dependencies:
    serde

keymap_editor -- crates/keymap_editor/Cargo.toml:
  unused dependencies:
    serde
    component

language_models -- crates/language_models/Cargo.toml:
  unused dependencies:
    project
    editor

languages -- crates/languages/Cargo.toml:
  unused dependencies:
    text
    rope
    workspace

livekit_client -- crates/livekit_client/Cargo.toml:
  unused dependencies:
    sha2
    serde_json
    objc

media -- crates/media/Cargo.toml:
  unused dependencies:
    ctor

multi_buffer -- crates/multi_buffer/Cargo.toml:
  unused dependencies:
    project

net -- crates/net/Cargo.toml:
  unused dependencies:
    anyhow

node_runtime -- crates/node_runtime/Cargo.toml:
  unused dependencies:
    async-std

notifications -- crates/notifications/Cargo.toml:
  unused dependencies:
    settings

outline -- crates/outline/Cargo.toml:
  unused dependencies:
    tree-sitter-typescript

picker -- crates/picker/Cargo.toml:
  unused dependencies:
    env_logger
    ctor

proto -- crates/proto/Cargo.toml:
  unused dependencies:
    typed-path

recent_projects -- crates/recent_projects/Cargo.toml:
  unused dependencies:
    serde
    dap
    task

remote_server -- crates/remote_server/Cargo.toml:
  unused dependencies:
    crash-handler
    git2
    minidumper
    serde
    dap
    workspace

repl -- crates/repl/Cargo.toml:
  unused dependencies:
    env_logger
    serde

reqwest_client -- crates/reqwest_client/Cargo.toml:
  unused dependencies:
    serde
    gpui

rules_library -- crates/rules_library/Cargo.toml:
  unused dependencies:
    serde

schema_generator -- crates/schema_generator/Cargo.toml:
  unused dependencies:
    serde

settings_profile_selector -- crates/settings_profile_selector/Cargo.toml:
  unused dependencies:
    client
    language

settings_ui -- crates/settings_ui/Cargo.toml:
  unused dependencies:
    futures
    zlog
    session
    node_runtime
    client
    assets
    language

supermaven -- crates/supermaven/Cargo.toml:
  unused dependencies:
    project
    theme
    http_client
    env_logger
    editor

tab_switcher -- crates/tab_switcher/Cargo.toml:
  unused dependencies:
    language
    anyhow

tasks_ui -- crates/tasks_ui/Cargo.toml:
  unused dependencies:
    serde

telemetry -- crates/telemetry/Cargo.toml:
  unused dependencies:
    serde

terminal_view -- crates/terminal_view/Cargo.toml:
  unused dependencies:
    rand
    client

text -- crates/text/Cargo.toml:
  unused dependencies:
    http_client

theme_selector -- crates/theme_selector/Cargo.toml:
  unused dependencies:
    serde

title_bar -- crates/title_bar/Cargo.toml:
  unused dependencies:
    pretty_assertions
    tree-sitter-md

ui -- crates/ui/Cargo.toml:
  unused dependencies:
    windows

util -- crates/util/Cargo.toml:
  unused dependencies:
    indoc

vim -- crates/vim/Cargo.toml:
  unused dependencies:
    assets

watch -- crates/watch/Cargo.toml:
  unused dependencies:
    rand

web_search -- crates/web_search/Cargo.toml:
  unused dependencies:
    serde

web_search_providers -- crates/web_search_providers/Cargo.toml:
  unused dependencies:
    serde

workspace -- crates/workspace/Cargo.toml:
  unused dependencies:
    windows
    dap

worktree -- crates/worktree/Cargo.toml:
  unused dependencies:
    serde
    git2

zed -- crates/zed/Cargo.toml:
  unused dependencies:
    profiling
    dap
    task

zeta -- crates/zeta/Cargo.toml:
  unused dependencies:
    reqwest_client
    call
    rpc
    serde
    tree-sitter-go

zeta2 -- crates/zeta2/Cargo.toml:
  unused dependencies:
    lsp

zeta2_tools -- crates/zeta2_tools/Cargo.toml:
  unused dependencies:
    zlog
    indoc
    clap
    serde
    settings
    pretty_assertions

root -- Cargo.toml:
  unused dependencies:
    pet-pixi
    collab
    wit-component
    num-traits
    storybook
    futures-batch
    plugin_macros
    cocoa-foundation
    ai
    hyper
    scheduler
    auto_update_helper
    plugin
    theme_importer
    rich_text


cargo-shear may have detected unused dependencies incorrectly due to its limitations.
They can be ignored by adding the crate name to the package's Cargo.toml:

[package.metadata.cargo-shear]
ignored = ["crate-name"]

or in the workspace Cargo.toml:

[workspace.metadata.cargo-shear]
ignored = ["crate-name"]

To automatically fix issues, run with --fix
```

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-spurious-fail-msvc CI spurious failure: target env msvc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pin macro no longer lifetime extends argument

8 participants