stabilize const_mut_refs

This commit is contained in:
Ralf Jung 2024-08-17 14:19:34 +02:00
parent b5ea5c23b3
commit 976131f896
4 changed files with 29 additions and 31 deletions

View File

@ -1,5 +1,8 @@
//@aux-build:proc_macro_derive.rs //@aux-build:proc_macro_derive.rs
#![feature(f128)]
#![feature(f16)]
#![allow( #![allow(
clippy::assign_op_pattern, clippy::assign_op_pattern,
clippy::erasing_op, clippy::erasing_op,
@ -10,9 +13,6 @@
arithmetic_overflow, arithmetic_overflow,
unconditional_panic unconditional_panic
)] )]
#![feature(const_mut_refs)]
#![feature(f128)]
#![feature(f16)]
#![warn(clippy::arithmetic_side_effects)] #![warn(clippy::arithmetic_side_effects)]
extern crate proc_macro_derive; extern crate proc_macro_derive;

View File

@ -1,7 +1,6 @@
#![warn(clippy::missing_const_for_fn)] #![warn(clippy::missing_const_for_fn)]
#![allow(incomplete_features, clippy::let_and_return, clippy::missing_transmute_annotations)] #![allow(incomplete_features, clippy::let_and_return, clippy::missing_transmute_annotations)]
#![allow(unsupported_calling_conventions)] #![allow(unsupported_calling_conventions)]
#![feature(const_mut_refs)]
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
use std::mem::transmute; use std::mem::transmute;

View File

@ -1,7 +1,6 @@
#![warn(clippy::missing_const_for_fn)] #![warn(clippy::missing_const_for_fn)]
#![allow(incomplete_features, clippy::let_and_return, clippy::missing_transmute_annotations)] #![allow(incomplete_features, clippy::let_and_return, clippy::missing_transmute_annotations)]
#![allow(unsupported_calling_conventions)] #![allow(unsupported_calling_conventions)]
#![feature(const_mut_refs)]
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
use std::mem::transmute; use std::mem::transmute;

View File

@ -1,5 +1,5 @@
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:15:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:14:5
| |
LL | / pub fn new() -> Self { LL | / pub fn new() -> Self {
LL | | LL | |
@ -16,7 +16,7 @@ LL | pub const fn new() -> Self {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:21:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:20:5
| |
LL | / fn const_generic_params<'a, T, const N: usize>(&self, b: &'a [T; N]) -> &'a [T; N] { LL | / fn const_generic_params<'a, T, const N: usize>(&self, b: &'a [T; N]) -> &'a [T; N] {
LL | | LL | |
@ -30,7 +30,7 @@ LL | const fn const_generic_params<'a, T, const N: usize>(&self, b: &'a [T;
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:28:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:27:1
| |
LL | / fn one() -> i32 { LL | / fn one() -> i32 {
LL | | LL | |
@ -44,7 +44,7 @@ LL | const fn one() -> i32 {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:34:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:33:1
| |
LL | / fn two() -> i32 { LL | / fn two() -> i32 {
LL | | LL | |
@ -59,7 +59,7 @@ LL | const fn two() -> i32 {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:41:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:40:1
| |
LL | / fn string() -> String { LL | / fn string() -> String {
LL | | LL | |
@ -73,7 +73,7 @@ LL | const fn string() -> String {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:47:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:46:1
| |
LL | / unsafe fn four() -> i32 { LL | / unsafe fn four() -> i32 {
LL | | LL | |
@ -87,7 +87,7 @@ LL | const unsafe fn four() -> i32 {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:53:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:52:1
| |
LL | / fn generic<T>(t: T) -> T { LL | / fn generic<T>(t: T) -> T {
LL | | LL | |
@ -101,7 +101,7 @@ LL | const fn generic<T>(t: T) -> T {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:62:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:61:1
| |
LL | / fn generic_arr<T: Copy>(t: [T; 1]) -> T { LL | / fn generic_arr<T: Copy>(t: [T; 1]) -> T {
LL | | LL | |
@ -115,7 +115,7 @@ LL | const fn generic_arr<T: Copy>(t: [T; 1]) -> T {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:76:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:75:9
| |
LL | / pub fn b(self, a: &A) -> B { LL | / pub fn b(self, a: &A) -> B {
LL | | LL | |
@ -129,7 +129,7 @@ LL | pub const fn b(self, a: &A) -> B {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:86:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:85:5
| |
LL | / fn const_fn_stabilized_before_msrv(byte: u8) { LL | / fn const_fn_stabilized_before_msrv(byte: u8) {
LL | | LL | |
@ -143,7 +143,7 @@ LL | const fn const_fn_stabilized_before_msrv(byte: u8) {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:98:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:97:1
| |
LL | / fn msrv_1_46() -> i32 { LL | / fn msrv_1_46() -> i32 {
LL | | LL | |
@ -157,7 +157,7 @@ LL | const fn msrv_1_46() -> i32 {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:118:1 --> tests/ui/missing_const_for_fn/could_be_const.rs:117:1
| |
LL | fn d(this: D) {} LL | fn d(this: D) {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -168,7 +168,7 @@ LL | const fn d(this: D) {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:126:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:125:9
| |
LL | / fn deref_ptr_can_be_const(self) -> usize { LL | / fn deref_ptr_can_be_const(self) -> usize {
LL | | LL | |
@ -182,7 +182,7 @@ LL | const fn deref_ptr_can_be_const(self) -> usize {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:131:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:130:9
| |
LL | / fn deref_copied_val(self) -> usize { LL | / fn deref_copied_val(self) -> usize {
LL | | LL | |
@ -196,7 +196,7 @@ LL | const fn deref_copied_val(self) -> usize {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:142:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:141:5
| |
LL | / fn union_access_can_be_const() { LL | / fn union_access_can_be_const() {
LL | | LL | |
@ -211,7 +211,7 @@ LL | const fn union_access_can_be_const() {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:150:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:149:9
| |
LL | extern "C" fn c() {} LL | extern "C" fn c() {}
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -222,7 +222,7 @@ LL | const extern "C" fn c() {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:154:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:153:9
| |
LL | extern fn implicit_c() {} LL | extern fn implicit_c() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -233,7 +233,7 @@ LL | const extern fn implicit_c() {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:171:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:170:9
| |
LL | / pub fn new(strings: Vec<String>) -> Self { LL | / pub fn new(strings: Vec<String>) -> Self {
LL | | Self { strings } LL | | Self { strings }
@ -246,7 +246,7 @@ LL | pub const fn new(strings: Vec<String>) -> Self {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:176:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:175:9
| |
LL | / pub fn empty() -> Self { LL | / pub fn empty() -> Self {
LL | | Self { strings: Vec::new() } LL | | Self { strings: Vec::new() }
@ -259,7 +259,7 @@ LL | pub const fn empty() -> Self {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:187:9 --> tests/ui/missing_const_for_fn/could_be_const.rs:186:9
| |
LL | / pub fn new(text: String) -> Self { LL | / pub fn new(text: String) -> Self {
LL | | let vec = Vec::new(); LL | | let vec = Vec::new();
@ -273,7 +273,7 @@ LL | pub const fn new(text: String) -> Self {
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:206:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:205:5
| |
LL | fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {} LL | fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -284,7 +284,7 @@ LL | const fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:210:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:209:5
| |
LL | extern "C-unwind" fn c_unwind() {} LL | extern "C-unwind" fn c_unwind() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -295,7 +295,7 @@ LL | const extern "C-unwind" fn c_unwind() {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:212:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:211:5
| |
LL | extern "system" fn system() {} LL | extern "system" fn system() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -306,7 +306,7 @@ LL | const extern "system" fn system() {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:214:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:213:5
| |
LL | extern "system-unwind" fn system_unwind() {} LL | extern "system-unwind" fn system_unwind() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -317,7 +317,7 @@ LL | const extern "system-unwind" fn system_unwind() {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:216:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:215:5
| |
LL | pub extern "stdcall" fn std_call() {} LL | pub extern "stdcall" fn std_call() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -328,7 +328,7 @@ LL | pub const extern "stdcall" fn std_call() {}
| +++++ | +++++
error: this could be a `const fn` error: this could be a `const fn`
--> tests/ui/missing_const_for_fn/could_be_const.rs:218:5 --> tests/ui/missing_const_for_fn/could_be_const.rs:217:5
| |
LL | pub extern "stdcall-unwind" fn std_call_unwind() {} LL | pub extern "stdcall-unwind" fn std_call_unwind() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^