about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-09-01 21:37:07 +0200
committerGitHub <noreply@github.com>2022-09-01 21:37:07 +0200
commitda1d7386014bd5dbe045d9f4f80921c3882719bc (patch)
tree9aa46333bc7a17a0f6f812fb6c2fbc355f1899e1 /tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
parent9af618b62e91b45d61f41548f24ba60b834e362b (diff)
parent4fdf43f23fbd4fb69960c9136dc796d8e64be785 (diff)
downloadrust-da1d7386014bd5dbe045d9f4f80921c3882719bc.tar.gz
rust-da1d7386014bd5dbe045d9f4f80921c3882719bc.zip
Rollup merge of #94467 - ibraheemdev:master, r=pnkfelix
Add `special_module_name` lint

Declaring `lib` as a module is one of the most common beginner mistakes when trying to setup a binary and library target in the same crate. `special_module_name` lints against it, as well as `mod main;`
```
warning: found module declaration for main.rs
  --> $DIR/special_module_name.rs:4:1
   |
LL | mod main;
   | ^^^^^^^^^
   |
   = note: a binary crate cannot be used as library

warning: found module declaration for lib.rs
  --> $DIR/special_module_name.rs:1:1
   |
LL | mod lib;
   | ^^^^^^^^
   |
   = note: `#[warn(special_module_name)]` on by default
   = note: lib.rs is the root of this crate's library target
   = help: to refer to it from other targets, use the library's name as the path
   ```

Note that the help message is not the best in that it doesn't provide an example of an import path (`the_actual_crate_name::`), and doesn't check whether the current file is part of a library/binary target to provide more specific error messages. I'm not sure where this lint would have to be run to access that information.
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff')
0 files changed, 0 insertions, 0 deletions