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

Default methods to not get the fixed_stack_segment attribute applied to IR #8794

Closed
brson opened this issue Aug 27, 2013 · 1 comment
Closed
Labels
A-codegen Area: Code generation

Comments

@brson
Copy link
Contributor

brson commented Aug 27, 2013

The test case in #8753, even after fixing lint, does not actually apply the fixed_stack_segment attribute to the default method.

@alexcrichton
Copy link
Member

Closing in favor of #10155, although that issue needs to make sure that the attribute is automatically applied in the IR.

xFrednet pushed a commit to xFrednet/rust that referenced this issue May 21, 2022
Address `unnecessary_to_owned` false positive

My proposed fix for rust-lang#8759 is to revise the conditions that delineate `redundant_clone` and `unnecessary_to_owned`:
```rust
        // Only flag cases satisfying at least one of the following three conditions:
        // * the referent and receiver types are distinct
        // * the referent/receiver type is a copyable array
        // * the method is `Cow::into_owned`
        // This restriction is to ensure there is no overlap between `redundant_clone` and this
        // lint. It also avoids the following false positive:
        //  rust-lang/rust-clippy#8759
        //   Arrays are a bit of a corner case. Non-copyable arrays are handled by
        // `redundant_clone`, but copyable arrays are not.
```
This change causes a few cases that were previously flagged by `unnecessary_to_owned` to no longer be flagged. But one could argue those cases would be better handled by `redundant_clone`.

Closes rust-lang#8759

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

No branches or pull requests

2 participants