about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-03-11 15:43:11 +0100
committerGitHub <noreply@github.com>2023-03-11 15:43:11 +0100
commitfbc121fdfd30daad5b99bae1aac4d6bd4d42ba02 (patch)
tree20a69adee2d22412e2e043ff363156dde11ef4f5 /compiler/rustc_codegen_gcc
parente350fe4e608b653da47e8012d13ef701613e717b (diff)
parenta90abd64fbb0764007d93d60823161f05f564259 (diff)
downloadrust-fbc121fdfd30daad5b99bae1aac4d6bd4d42ba02.tar.gz
rust-fbc121fdfd30daad5b99bae1aac4d6bd4d42ba02.zip
Rollup merge of #104363 - WaffleLapkin:bonk_box_new, r=Nilstrieb
Make `unused_allocation` lint against `Box::new` too

Previously it only linted against `box` syntax, which likely won't ever be stabilized, which is pretty useless. Even now I'm not sure if it's a meaningful lint, but it's at least something :shrug:

This means that code like the following will be linted against:
```rust
Box::new([1, 2, 3]).len();
f(&Box::new(1)); // where f : &i32 -> ()
```
The lint works by checking if a `Box::new` (or `box`) expression has an a borrow adjustment, meaning that the code that first stores the box in a variable won't be linted against:
```rust
let boxed = Box::new([1, 2, 3]); // no lint
boxed.len();
```
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions