Skip to content
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

kind checker does not recognize implicit returns #1390

Closed
marijnh opened this issue Dec 28, 2011 · 0 comments
Closed

kind checker does not recognize implicit returns #1390

marijnh opened this issue Dec 28, 2011 · 0 comments
Labels
A-type-system Area: Type system

Comments

@marijnh
Copy link
Contributor

marijnh commented Dec 28, 2011

This shouldn't compile without annotating the parameter as copy kind, but it does:

 fn id<T>(x: T) -> T { x }

If you return by ret, the problem is detected.

@marijnh marijnh closed this as completed in 8c14943 Jan 2, 2012
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 11, 2021
…ishearth

Compare empty blocks for equality based on tokens

fixes: rust-lang#1390

This only considers empty blocks for now, though we should also catch something like this:

```rust
match 0 {
    0 => {
        do_something();
        trace!(0);
        0
    }
    1 => {
        do_something();
        trace!(1);
        1
    }
    x => x,
}
```

As far as I can tell there aren't any negative effects on other lints. These blocks only happen to be the same for a given compilation, not all compilations.

changelog: Fix `match_on_same_arms` and others. Only consider empty blocks equal if the tokens contained are the same.
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

1 participant