Merge remote-tracking branch 'upstream/master' into rustup

This commit is contained in:
Philipp Krones 2025-01-28 18:28:57 +01:00
commit 145d5adf04
No known key found for this signature in database
GPG key ID: 1CA0DF2AF59D68A5
282 changed files with 5798 additions and 885 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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