Skip to content

Conversation

A4-Tacks
Copy link
Contributor

@A4-Tacks A4-Tacks commented Oct 9, 2025

Example

fn foo() {
    let f = ||$0 {loop {}};
    let _: fn() -> i8 = f;
}

Before this PR:

fn foo() {
    let f = || -> ! {loop {}};
    let _: fn() -> i8 = f;
}

mismatched types error on line 3

After this PR:

fn foo() {
    let f = || -> i8 {loop {}};
    let _: fn() -> i8 = f;
}

Example
---
```rust
fn foo() {
    let f = ||$0 {loop {}};
    let _: fn() -> i8 = f;
}
```

**Before this PR**:

```rust
fn foo() {
    let f = || -> ! {loop {}};
    let _: fn() -> i8 = f;
}
```

mismatched types error on line 3

**After this PR**:

```rust
fn foo() {
    let f = || -> i8 {loop {}};
    let _: fn() -> i8 = f;
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 9, 2025
Copy link
Member

@ShoyuVanilla ShoyuVanilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Oct 10, 2025
Merged via the queue into rust-lang:master with commit 6342f3f Oct 10, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 10, 2025
@A4-Tacks A4-Tacks deleted the add-ret-ty-adjusted branch October 10, 2025 12:16
@lnicola lnicola changed the title Fix closure coerced return type for add_return_type fix: handle closure return type adjustments in add_return_type Oct 14, 2025
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.

3 participants