1
Fork 0
rust/compiler/rustc_mir/src
Mara e6a6df5daa
Rollup merge of #80723 - rylev:noop-lint-pass, r=estebank
Implement NOOP_METHOD_CALL lint

Implements the beginnings of https://github.com/rust-lang/lang-team/issues/67 - a lint for detecting noop method calls (e.g, calling `<&T as Clone>::clone()` when `T: !Clone`).

This PR does not fully realize the vision and has a few limitations that need to be addressed either before merging or in subsequent PRs:
* [ ] No UFCS support
* [ ] The warning message is pretty plain
* [ ] Doesn't work for `ToOwned`

The implementation uses [`Instance::resolve`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/instance/struct.Instance.html#method.resolve) which is normally later in the compiler. It seems that there are some invariants that this function relies on that we try our best to respect. For instance, it expects substitutions to have happened, which haven't yet performed, but we check first for `needs_subst` to ensure we're dealing with a monomorphic type.

Thank you to ```@davidtwco,``` ```@Aaron1011,``` and ```@wesleywiser``` for helping me at various points through out this PR ❤️.
2021-03-05 10:57:14 +01:00
..
borrow_check Rollup merge of #80723 - rylev:noop-lint-pass, r=estebank 2021-03-05 10:57:14 +01:00
const_eval fix review 2021-02-25 04:21:12 +03:00
dataflow Auto merge of #78429 - casey:doctest-attribute-splitting, r=jyn514 2021-02-26 00:17:22 +00:00
interpret Add a getter for Frame.loc 2021-02-27 21:01:02 +01:00
monomorphize Use log level to control partitioning debug output 2021-02-24 00:00:00 +00:00
transform Auto merge of #81114 - bugadani:generator, r=estebank 2021-03-04 00:23:42 +00:00
util Box generator-related Body fields 2021-03-01 08:32:49 +01:00
lib.rs Stabilize str_split_once 2021-02-09 23:17:11 -05:00
shim.rs Box generator-related Body fields 2021-03-01 08:32:49 +01:00