Merge remote-tracking branch 'upstream/master' into rustup
This commit is contained in:
commit
145d5adf04
282 changed files with 5798 additions and 885 deletions
|
|
@ -210,3 +210,9 @@ mod with_ty_alias {
|
|||
let _: Foo = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not lint because mutable references in const functions are unstable in 1.82
|
||||
#[clippy::msrv = "1.82"]
|
||||
fn mut_add(x: &mut i32) {
|
||||
*x += 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,3 +213,8 @@ mod extern_fn {
|
|||
const extern "system-unwind" fn system_unwind() {}
|
||||
//~^ ERROR: this could be a `const fn`
|
||||
}
|
||||
|
||||
const fn mut_add(x: &mut i32) {
|
||||
//~^ ERROR: this could be a `const fn`
|
||||
*x += 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,3 +213,8 @@ mod extern_fn {
|
|||
extern "system-unwind" fn system_unwind() {}
|
||||
//~^ ERROR: this could be a `const fn`
|
||||
}
|
||||
|
||||
fn mut_add(x: &mut i32) {
|
||||
//~^ ERROR: this could be a `const fn`
|
||||
*x += 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,5 +316,19 @@ help: make the function `const`
|
|||
LL | const extern "system-unwind" fn system_unwind() {}
|
||||
| +++++
|
||||
|
||||
error: aborting due to 24 previous errors
|
||||
error: this could be a `const fn`
|
||||
--> tests/ui/missing_const_for_fn/could_be_const.rs:217:1
|
||||
|
|
||||
LL | / fn mut_add(x: &mut i32) {
|
||||
LL | |
|
||||
LL | | *x += 1;
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
help: make the function `const`
|
||||
|
|
||||
LL | const fn mut_add(x: &mut i32) {
|
||||
| +++++
|
||||
|
||||
error: aborting due to 25 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue