forked from rust-lang/rust-clippy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework use_self impl based on ty::Ty comparison rust-lang#3410
- Loading branch information
Showing
8 changed files
with
294 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,13 @@ | ||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:13:5 | ||
| | ||
LL | / pub fn new() -> Self { | ||
LL | | Self { guess: 42 } | ||
LL | | } | ||
| |_____^ | ||
| | ||
= note: `-D clippy::missing-const-for-fn` implied by `-D warnings` | ||
error: internal compiler error: src/librustc_middle/ty/context.rs:516: node_type: no type for node `expr N (hir_id=HirId { owner: DefId(0:8 ~ could_be_const[317d]::{{impl}}[0]::const_generic_params[0]), local_id: 22 })` | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:17:5 | ||
| | ||
LL | / fn const_generic_params<'a, T, const N: usize>(&self, b: &'a [T; N]) -> &'a [T; N] { | ||
LL | | b | ||
LL | | } | ||
| |_____^ | ||
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:904:9 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:23:1 | ||
| | ||
LL | / fn one() -> i32 { | ||
LL | | 1 | ||
LL | | } | ||
| |_^ | ||
note: the compiler unexpectedly panicked. this is a bug. | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:28:1 | ||
| | ||
LL | / fn two() -> i32 { | ||
LL | | let abc = 2; | ||
LL | | abc | ||
LL | | } | ||
| |_^ | ||
note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:34:1 | ||
| | ||
LL | / fn string() -> String { | ||
LL | | String::new() | ||
LL | | } | ||
| |_^ | ||
note: Clippy version: clippy 0.0.212 (517d0ff3 2020-04-23) | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:39:1 | ||
| | ||
LL | / unsafe fn four() -> i32 { | ||
LL | | 4 | ||
LL | | } | ||
| |_^ | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:44:1 | ||
| | ||
LL | / fn generic<T>(t: T) -> T { | ||
LL | | t | ||
LL | | } | ||
| |_^ | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:48:1 | ||
| | ||
LL | / fn sub(x: u32) -> usize { | ||
LL | | unsafe { transmute(&x) } | ||
LL | | } | ||
| |_^ | ||
|
||
error: this could be a `const fn` | ||
--> $DIR/could_be_const.rs:67:9 | ||
| | ||
LL | / pub fn b(self, a: &A) -> B { | ||
LL | | B | ||
LL | | } | ||
| |_________^ | ||
|
||
error: aborting due to 9 previous errors | ||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ impl Mul for Bad { | |
|
||
impl Clone for Bad { | ||
fn clone(&self) -> Self { | ||
Self | ||
Bad | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.