Auto merge of #104087 - nbdd0121:const, r=scottmcm

Stabilise inline_const

# Stabilisation Report

## Summary

This PR will stabilise `inline_const` feature in expression position. `inline_const_pat` is still unstable and will *not* be stabilised.

The feature will allow code like this:
```rust
foo(const { 1 + 1 })
```
which is roughly desugared into
```rust
struct Foo;
impl Foo {
    const FOO: i32 = 1 + 1;
}
foo(Foo::FOO)
```

This feature is from https://github.com/rust-lang/rfcs/pull/2920 and is tracked in #76001 (the tracking issue should *not* be closed as it needs to track inline const in pattern position). The initial implementation is done in #77124.

## Difference from RFC

There are two major differences (enhancements) as implemented from the RFC. First thing is that the RFC says that the type of an inline const block inferred from the content *within* it, but we currently can infer the type using the information from outside the const block as well. This is a frequently requested feature to the initial implementation (e.g. #89964). The inference is implemented in #89561 and is done by treating inline const similar to a closure and therefore share inference context with its parent body.

This allows code like:
```rust
let v: Vec<i32> = const { Vec::new() };
```

Another enhancement that differs from the RFC is that we currently allow inline consts to reference generic parameters. This is implemented in #96557.

This allows code like:
```rust
fn create_none_array<T, const N: usize>() -> [Option<T>; N] {
    [const { None::<T> }; N]
}
```

This enhancement also makes inline const usable as static asserts:

```rust
fn require_zst<T>() {
    const { assert!(std::mem::size_of::<T>() == 0) }
}
```

## Documentation

Reference: rust-lang/reference#1295

## Unresolved issues

We still have a few issues that are not resolved, but I don't think it necessarily has to block stabilisation:
* expr fragment specifier issue: #86730
* ~~`const {}` behaves similar to `async {}` but not to `{}` and `unsafe {}` (they are treated as `ExpressionWithoutBlock` rather than `ExpressionWithBlock`): https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/const.20blocks.20differ.20from.20normal.20and.20from.20unsafe.20blocks/near/290229453~~

## Tests

There are a few tests in https://github.com/rust-lang/rust/tree/master/src/test/ui/inline-const
This commit is contained in:
bors 2024-04-24 17:23:03 +00:00
commit 7bb4f0889e
95 changed files with 206 additions and 319 deletions

View file

@ -556,7 +556,6 @@ macro_rules! gate_all {
half_open_range_patterns_in_slices,
"half-open range patterns in slices are unstable"
);
gate_all!(inline_const, "inline-const is experimental");
gate_all!(inline_const_pat, "inline-const in pattern position is experimental");
gate_all!(associated_const_equality, "associated const equality is incomplete");
gate_all!(yeet_expr, "`do yeet` expression is experimental");

View file

@ -211,6 +211,8 @@ macro_rules! declare_features {
(accepted, inclusive_range_syntax, "1.26.0", Some(28237)),
/// Allows inferring outlives requirements (RFC 2093).
(accepted, infer_outlives_requirements, "1.30.0", Some(44493)),
/// Allow anonymous constants from an inline `const` block
(accepted, inline_const, "CURRENT_RUSTC_VERSION", Some(76001)),
/// Allows irrefutable patterns in `if let` and `while let` statements (RFC 2086).
(accepted, irrefutable_let_patterns, "1.33.0", Some(44495)),
/// Allows `#[instruction_set(_)]` attribute.

View file

@ -501,8 +501,6 @@ pub fn internal(&self, feature: Symbol) -> bool {
(unstable, impl_trait_in_fn_trait_return, "1.64.0", Some(99697)),
/// Allows associated types in inherent impls.
(incomplete, inherent_associated_types, "1.52.0", Some(8995)),
/// Allow anonymous constants from an inline `const` block
(unstable, inline_const, "1.49.0", Some(76001)),
/// Allow anonymous constants from an inline `const` block in pattern position
(unstable, inline_const_pat, "1.58.0", Some(76001)),
/// Allows using `pointer` and `reference` in intra-doc links

View file

@ -37,7 +37,7 @@
#![feature(coroutines)]
#![feature(stmt_expr_attributes)]
#![feature(if_let_guard)]
#![feature(inline_const)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(iter_from_coroutine)]
#![feature(negative_impls)]
#![feature(never_type)]

View file

@ -4,7 +4,7 @@
#![feature(cow_is_borrowed)]
#![feature(decl_macro)]
#![feature(impl_trait_in_assoc_type)]
#![feature(inline_const)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(is_sorted)]
#![feature(let_chains)]
#![feature(map_try_insert)]

View file

@ -1252,8 +1252,6 @@ fn parse_constness_(&mut self, case: Case, is_closure: bool) -> Const {
fn parse_const_block(&mut self, span: Span, pat: bool) -> PResult<'a, P<Expr>> {
if pat {
self.psess.gated_spans.gate(sym::inline_const_pat, span);
} else {
self.psess.gated_spans.gate(sym::inline_const, span);
}
self.eat_keyword(kw::Const);
let (attrs, blk) = self.parse_inner_attrs_and_block()?;

View file

@ -11,7 +11,7 @@
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![feature(const_option)]
#![feature(core_intrinsics)]
#![feature(inline_const)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(min_specialization)]
#![feature(never_type)]
#![feature(ptr_sub_ptr)]

View file

@ -128,7 +128,6 @@
#![feature(fn_traits)]
#![feature(hasher_prefixfree_extras)]
#![feature(hint_assert_unchecked)]
#![feature(inline_const)]
#![feature(inplace_iteration)]
#![feature(iter_advance_by)]
#![feature(iter_next_chunk)]
@ -169,6 +168,7 @@
// Language features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
#![cfg_attr(bootstrap, feature(inline_const))]
#![cfg_attr(not(bootstrap), rustc_preserve_ub_checks)]
#![cfg_attr(not(test), feature(coroutine_trait))]
#![cfg_attr(test, feature(panic_update_hook))]

View file

@ -201,6 +201,7 @@
//
// Language features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(abi_unadjusted)]
#![feature(adt_const_params)]
#![feature(allow_internal_unsafe)]
@ -231,7 +232,6 @@
#![feature(fundamental)]
#![feature(generic_arg_infer)]
#![feature(if_let_guard)]
#![feature(inline_const)]
#![feature(intra_doc_pointers)]
#![feature(intrinsics)]
#![feature(lang_items)]

View file

@ -511,7 +511,8 @@ pub fn from_mut(v: &mut bool) -> &mut Self {
/// # Examples
///
/// ```
/// #![feature(atomic_from_mut, inline_const)]
/// #![feature(atomic_from_mut)]
/// # #![cfg_attr(bootstrap, feature(inline_const))]
/// use std::sync::atomic::{AtomicBool, Ordering};
///
/// let mut some_bools = [const { AtomicBool::new(false) }; 10];
@ -1313,7 +1314,8 @@ pub fn from_mut(v: &mut *mut T) -> &mut Self {
/// # Examples
///
/// ```
/// #![feature(atomic_from_mut, inline_const)]
/// #![feature(atomic_from_mut)]
/// # #![cfg_attr(bootstrap, feature(inline_const))]
/// use std::ptr::null_mut;
/// use std::sync::atomic::{AtomicPtr, Ordering};
///
@ -2303,7 +2305,8 @@ pub fn from_mut(v: &mut $int_type) -> &mut Self {
/// # Examples
///
/// ```
/// #![feature(atomic_from_mut, inline_const)]
/// #![feature(atomic_from_mut)]
/// # #![cfg_attr(bootstrap, feature(inline_const))]
#[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")]
///
#[doc = concat!("let mut some_ints = [const { ", stringify!($atomic_type), "::new(0) }; 10];")]

View file

@ -46,7 +46,7 @@
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]
#![feature(try_find)]
#![feature(inline_const)]
#![cfg_attr(bootstrap, feature(inline_const))]
#![feature(is_sorted)]
#![feature(layout_for_ptr)]
#![feature(pattern)]

View file

@ -7,7 +7,6 @@
convert_float_to_int,
core_intrinsics,
decl_macro,
inline_const,
intra_doc_pointers,
repr_simd,
simd_ffi,

View file

@ -2,8 +2,6 @@
The tracking issue for this feature is: [#76001]
See also [`inline_const`](inline-const.md)
------
This feature allows you to use inline constant expressions in pattern position:

View file

@ -1,32 +0,0 @@
# `inline_const`
The tracking issue for this feature is: [#76001]
See also [`inline_const_pat`](inline-const-pat.md)
------
This feature allows you to use inline constant expressions. For example, you can
turn this code:
```rust
# fn add_one(x: i32) -> i32 { x + 1 }
const MY_COMPUTATION: i32 = 1 + 2 * 3 / 4;
fn main() {
let x = add_one(MY_COMPUTATION);
}
```
into this code:
```rust
#![feature(inline_const)]
# fn add_one(x: i32) -> i32 { x + 1 }
fn main() {
let x = add_one(const { 1 + 2 * 3 / 4 });
}
```
[#76001]: https://github.com/rust-lang/rust/issues/76001

View file

@ -1,4 +1,3 @@
#![feature(inline_const)]
#![warn(clippy::indexing_slicing)]
// We also check the out_of_bounds_indexing lint here, because it lints similar things and
// we want to avoid false positives.

View file

@ -1,5 +1,5 @@
error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:27:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:26:5
|
LL | x[index];
| ^^^^^^^^
@ -9,7 +9,7 @@ LL | x[index];
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:42:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:41:5
|
LL | v[0];
| ^^^^
@ -17,7 +17,7 @@ LL | v[0];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:43:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:42:5
|
LL | v[10];
| ^^^^^
@ -25,7 +25,7 @@ LL | v[10];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:44:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:43:5
|
LL | v[1 << 3];
| ^^^^^^^^^
@ -33,7 +33,7 @@ LL | v[1 << 3];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:50:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:49:5
|
LL | v[N];
| ^^^^
@ -41,7 +41,7 @@ LL | v[N];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui-toml/suppress_lint_in_const/test.rs:51:5
--> tests/ui-toml/suppress_lint_in_const/test.rs:50:5
|
LL | v[M];
| ^^^^

View file

@ -10,7 +10,7 @@
arithmetic_overflow,
unconditional_panic
)]
#![feature(const_mut_refs, inline_const)]
#![feature(const_mut_refs)]
#![warn(clippy::arithmetic_side_effects)]
extern crate proc_macro_derive;

View file

@ -1,4 +1,4 @@
#![feature(let_chains, inline_const)]
#![feature(let_chains)]
#![warn(clippy::bool_to_int_with_if)]
#![allow(unused, dead_code, clippy::unnecessary_operation, clippy::no_effect)]

View file

@ -1,4 +1,4 @@
#![feature(let_chains, inline_const)]
#![feature(let_chains)]
#![warn(clippy::bool_to_int_with_if)]
#![allow(unused, dead_code, clippy::unnecessary_operation, clippy::no_effect)]

View file

@ -1,4 +1,3 @@
#![feature(inline_const)]
#![warn(clippy::const_is_empty)]
#![allow(clippy::needless_late_init, unused_must_use)]

View file

@ -1,5 +1,5 @@
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:6:8
--> tests/ui/const_is_empty.rs:5:8
|
LL | if "".is_empty() {
| ^^^^^^^^^^^^^
@ -8,151 +8,151 @@ LL | if "".is_empty() {
= help: to override `-D warnings` add `#[allow(clippy::const_is_empty)]`
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:9:8
--> tests/ui/const_is_empty.rs:8:8
|
LL | if "foobar".is_empty() {
| ^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:15:8
--> tests/ui/const_is_empty.rs:14:8
|
LL | if b"".is_empty() {
| ^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:18:8
--> tests/ui/const_is_empty.rs:17:8
|
LL | if b"foobar".is_empty() {
| ^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:35:8
--> tests/ui/const_is_empty.rs:34:8
|
LL | if empty2.is_empty() {
| ^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:38:8
--> tests/ui/const_is_empty.rs:37:8
|
LL | if non_empty2.is_empty() {
| ^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:60:13
--> tests/ui/const_is_empty.rs:59:13
|
LL | let _ = EMPTY_STR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:62:13
--> tests/ui/const_is_empty.rs:61:13
|
LL | let _ = NON_EMPTY_STR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:64:13
--> tests/ui/const_is_empty.rs:63:13
|
LL | let _ = EMPTY_BSTR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:66:13
--> tests/ui/const_is_empty.rs:65:13
|
LL | let _ = NON_EMPTY_BSTR.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:68:13
--> tests/ui/const_is_empty.rs:67:13
|
LL | let _ = EMPTY_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:70:13
--> tests/ui/const_is_empty.rs:69:13
|
LL | let _ = EMPTY_ARRAY_REPEAT.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:72:13
--> tests/ui/const_is_empty.rs:71:13
|
LL | let _ = EMPTY_U8_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:74:13
--> tests/ui/const_is_empty.rs:73:13
|
LL | let _ = NON_EMPTY_U8_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:76:13
--> tests/ui/const_is_empty.rs:75:13
|
LL | let _ = NON_EMPTY_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:78:13
--> tests/ui/const_is_empty.rs:77:13
|
LL | let _ = NON_EMPTY_ARRAY_REPEAT.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:80:13
--> tests/ui/const_is_empty.rs:79:13
|
LL | let _ = EMPTY_REF_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:82:13
--> tests/ui/const_is_empty.rs:81:13
|
LL | let _ = NON_EMPTY_REF_ARRAY.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:84:13
--> tests/ui/const_is_empty.rs:83:13
|
LL | let _ = EMPTY_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:86:13
--> tests/ui/const_is_empty.rs:85:13
|
LL | let _ = NON_EMPTY_SLICE.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:88:13
--> tests/ui/const_is_empty.rs:87:13
|
LL | let _ = NON_EMPTY_SLICE_REPEAT.is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:94:13
--> tests/ui/const_is_empty.rs:93:13
|
LL | let _ = value.is_empty();
| ^^^^^^^^^^^^^^^^
error: this expression always evaluates to false
--> tests/ui/const_is_empty.rs:97:13
--> tests/ui/const_is_empty.rs:96:13
|
LL | let _ = x.is_empty();
| ^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:99:13
--> tests/ui/const_is_empty.rs:98:13
|
LL | let _ = "".is_empty();
| ^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:101:13
--> tests/ui/const_is_empty.rs:100:13
|
LL | let _ = b"".is_empty();
| ^^^^^^^^^^^^^^
error: this expression always evaluates to true
--> tests/ui/const_is_empty.rs:155:13
--> tests/ui/const_is_empty.rs:154:13
|
LL | let _ = val.is_empty();
| ^^^^^^^^^^^^^^

View file

@ -1,6 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![feature(inline_const)]
#![warn(clippy::indexing_slicing)]
// We also check the out_of_bounds_indexing lint here, because it lints similar things and
// we want to avoid false positives.

View file

@ -1,5 +1,5 @@
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:16:20
--> tests/ui/indexing_slicing_index.rs:15:20
|
LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
| ^^^^^^^^^^
@ -10,19 +10,19 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
error[E0080]: evaluation of `main::{constant#3}` failed
--> tests/ui/indexing_slicing_index.rs:48:14
--> tests/ui/indexing_slicing_index.rs:47:14
|
LL | const { &ARR[idx4()] };
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
note: erroneous constant encountered
--> tests/ui/indexing_slicing_index.rs:48:5
--> tests/ui/indexing_slicing_index.rs:47:5
|
LL | const { &ARR[idx4()] };
| ^^^^^^^^^^^^^^^^^^^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:29:5
--> tests/ui/indexing_slicing_index.rs:28:5
|
LL | x[index];
| ^^^^^^^^
@ -30,7 +30,7 @@ LL | x[index];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:32:5
--> tests/ui/indexing_slicing_index.rs:31:5
|
LL | x[4];
| ^^^^
@ -39,13 +39,13 @@ LL | x[4];
= help: to override `-D warnings` add `#[allow(clippy::out_of_bounds_indexing)]`
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:34:5
--> tests/ui/indexing_slicing_index.rs:33:5
|
LL | x[1 << 3];
| ^^^^^^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:45:14
--> tests/ui/indexing_slicing_index.rs:44:14
|
LL | const { &ARR[idx()] };
| ^^^^^^^^^^
@ -54,7 +54,7 @@ LL | const { &ARR[idx()] };
= note: the suggestion might not be applicable in constant blocks
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:48:14
--> tests/ui/indexing_slicing_index.rs:47:14
|
LL | const { &ARR[idx4()] };
| ^^^^^^^^^^^
@ -63,13 +63,13 @@ LL | const { &ARR[idx4()] };
= note: the suggestion might not be applicable in constant blocks
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:55:5
--> tests/ui/indexing_slicing_index.rs:54:5
|
LL | y[4];
| ^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:58:5
--> tests/ui/indexing_slicing_index.rs:57:5
|
LL | v[0];
| ^^^^
@ -77,7 +77,7 @@ LL | v[0];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:60:5
--> tests/ui/indexing_slicing_index.rs:59:5
|
LL | v[10];
| ^^^^^
@ -85,7 +85,7 @@ LL | v[10];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:62:5
--> tests/ui/indexing_slicing_index.rs:61:5
|
LL | v[1 << 3];
| ^^^^^^^^^
@ -93,13 +93,13 @@ LL | v[1 << 3];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:70:5
--> tests/ui/indexing_slicing_index.rs:69:5
|
LL | x[N];
| ^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:73:5
--> tests/ui/indexing_slicing_index.rs:72:5
|
LL | v[N];
| ^^^^
@ -107,7 +107,7 @@ LL | v[N];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:75:5
--> tests/ui/indexing_slicing_index.rs:74:5
|
LL | v[M];
| ^^^^
@ -115,7 +115,7 @@ LL | v[M];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:79:13
--> tests/ui/indexing_slicing_index.rs:78:13
|
LL | let _ = x[4];
| ^^^^

View file

@ -2,7 +2,6 @@
//@aux-build:proc_macros.rs
#![allow(clippy::needless_if, unused)]
#![warn(clippy::manual_is_infinite, clippy::manual_is_finite)]
#![feature(inline_const)]
#[macro_use]
extern crate proc_macros;

View file

@ -1,5 +1,5 @@
error: manually checking if a float is infinite
--> tests/ui/manual_float_methods.rs:23:8
--> tests/ui/manual_float_methods.rs:22:8
|
LL | if x == f32::INFINITY || x == f32::NEG_INFINITY {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()`
@ -8,7 +8,7 @@ LL | if x == f32::INFINITY || x == f32::NEG_INFINITY {}
= help: to override `-D warnings` add `#[allow(clippy::manual_is_infinite)]`
error: manually checking if a float is finite
--> tests/ui/manual_float_methods.rs:24:8
--> tests/ui/manual_float_methods.rs:23:8
|
LL | if x != f32::INFINITY && x != f32::NEG_INFINITY {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -29,13 +29,13 @@ LL | if !x.is_infinite() {}
| ~~~~~~~~~~~~~~~~
error: manually checking if a float is infinite
--> tests/ui/manual_float_methods.rs:25:8
--> tests/ui/manual_float_methods.rs:24:8
|
LL | if x == INFINITE || x == NEG_INFINITE {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()`
error: manually checking if a float is finite
--> tests/ui/manual_float_methods.rs:26:8
--> tests/ui/manual_float_methods.rs:25:8
|
LL | if x != INFINITE && x != NEG_INFINITE {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -54,13 +54,13 @@ LL | if !x.is_infinite() {}
| ~~~~~~~~~~~~~~~~
error: manually checking if a float is infinite
--> tests/ui/manual_float_methods.rs:28:8
--> tests/ui/manual_float_methods.rs:27:8
|
LL | if x == f64::INFINITY || x == f64::NEG_INFINITY {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()`
error: manually checking if a float is finite
--> tests/ui/manual_float_methods.rs:29:8
--> tests/ui/manual_float_methods.rs:28:8
|
LL | if x != f64::INFINITY && x != f64::NEG_INFINITY {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,4 @@
#![feature(inline_const, try_blocks)]
#![feature(try_blocks)]
#![allow(
clippy::eq_op,
clippy::single_match,

View file

@ -1,5 +1,4 @@
#![allow(clippy::assertions_on_constants, clippy::eq_op, clippy::let_unit_value)]
#![feature(inline_const)]
#![warn(clippy::unimplemented, clippy::unreachable, clippy::todo, clippy::panic)]
extern crate core;

View file

@ -1,5 +1,5 @@
error: `panic` should not be present in production code
--> tests/ui/panicking_macros.rs:23:5
--> tests/ui/panicking_macros.rs:22:5
|
LL | panic!();
| ^^^^^^^^
@ -8,19 +8,19 @@ LL | panic!();
= help: to override `-D warnings` add `#[allow(clippy::panic)]`
error: `panic` should not be present in production code
--> tests/ui/panicking_macros.rs:26:5
--> tests/ui/panicking_macros.rs:25:5
|
LL | panic!("message");
| ^^^^^^^^^^^^^^^^^
error: `panic` should not be present in production code
--> tests/ui/panicking_macros.rs:28:5
--> tests/ui/panicking_macros.rs:27:5
|
LL | panic!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `todo` should not be present in production code
--> tests/ui/panicking_macros.rs:35:5
--> tests/ui/panicking_macros.rs:34:5
|
LL | todo!();
| ^^^^^^^
@ -29,19 +29,19 @@ LL | todo!();
= help: to override `-D warnings` add `#[allow(clippy::todo)]`
error: `todo` should not be present in production code
--> tests/ui/panicking_macros.rs:38:5
--> tests/ui/panicking_macros.rs:37:5
|
LL | todo!("message");
| ^^^^^^^^^^^^^^^^
error: `todo` should not be present in production code
--> tests/ui/panicking_macros.rs:40:5
--> tests/ui/panicking_macros.rs:39:5
|
LL | todo!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `unimplemented` should not be present in production code
--> tests/ui/panicking_macros.rs:47:5
--> tests/ui/panicking_macros.rs:46:5
|
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^
@ -50,19 +50,19 @@ LL | unimplemented!();
= help: to override `-D warnings` add `#[allow(clippy::unimplemented)]`
error: `unimplemented` should not be present in production code
--> tests/ui/panicking_macros.rs:50:5
--> tests/ui/panicking_macros.rs:49:5
|
LL | unimplemented!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: `unimplemented` should not be present in production code
--> tests/ui/panicking_macros.rs:52:5
--> tests/ui/panicking_macros.rs:51:5
|
LL | unimplemented!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: usage of the `unreachable!` macro
--> tests/ui/panicking_macros.rs:59:5
--> tests/ui/panicking_macros.rs:58:5
|
LL | unreachable!();
| ^^^^^^^^^^^^^^
@ -71,37 +71,37 @@ LL | unreachable!();
= help: to override `-D warnings` add `#[allow(clippy::unreachable)]`
error: usage of the `unreachable!` macro
--> tests/ui/panicking_macros.rs:62:5
--> tests/ui/panicking_macros.rs:61:5
|
LL | unreachable!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^
error: usage of the `unreachable!` macro
--> tests/ui/panicking_macros.rs:64:5
--> tests/ui/panicking_macros.rs:63:5
|
LL | unreachable!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `panic` should not be present in production code
--> tests/ui/panicking_macros.rs:71:5
--> tests/ui/panicking_macros.rs:70:5
|
LL | panic!();
| ^^^^^^^^
error: `todo` should not be present in production code
--> tests/ui/panicking_macros.rs:73:5
--> tests/ui/panicking_macros.rs:72:5
|
LL | todo!();
| ^^^^^^^
error: `unimplemented` should not be present in production code
--> tests/ui/panicking_macros.rs:75:5
--> tests/ui/panicking_macros.rs:74:5
|
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^
error: usage of the `unreachable!` macro
--> tests/ui/panicking_macros.rs:77:5
--> tests/ui/panicking_macros.rs:76:5
|
LL | unreachable!();
| ^^^^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
//@compile-flags: -Zmiri-strict-provenance
#![feature(portable_simd, adt_const_params, inline_const, core_intrinsics)]
#![feature(portable_simd, adt_const_params, core_intrinsics)]
#![allow(incomplete_features, internal_features)]
use std::intrinsics::simd as intrinsics;
use std::ptr;

View file

@ -1,7 +1,5 @@
//@ compile-flags: --crate-type=lib -Copt-level=0 -Zmir-opt-level=0 -C debuginfo=2
#![feature(inline_const)]
// Test that we don't generate a memory allocation for the constant
// and read the fields from that, but instead just create the value pair directly.
pub fn foo() -> (i32, i32) {

View file

@ -4,7 +4,6 @@
#![crate_type = "lib"]
#![feature(core_intrinsics)]
#![feature(custom_mir)]
#![feature(inline_const)]
#![allow(unreachable_code)]
use std::intrinsics::{transmute, transmute_unchecked};

View file

@ -1,7 +1,6 @@
//@ compile-flags: -O
#![crate_type = "lib"]
#![feature(inline_const)]
use std::mem::MaybeUninit;

View file

@ -5,7 +5,7 @@
//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
#![crate_type="lib"]
#![feature(inline_const, type_alias_impl_trait)]
#![feature(type_alias_impl_trait)]
extern crate core;

View file

@ -4,7 +4,6 @@
#![crate_type = "lib"]
#![allow(non_camel_case_types)]
#![feature(repr_simd, intrinsics)]
#![feature(inline_const)]
#[repr(simd)]
#[derive(Copy, Clone)]

View file

@ -1,5 +1,5 @@
// skip-filecheck
#![feature(custom_mir, core_intrinsics, inline_const)]
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;

View file

@ -1,5 +1,5 @@
// skip-filecheck
#![feature(custom_mir, core_intrinsics, inline_const)]
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;

View file

@ -1,6 +1,6 @@
// skip-filecheck
//@ compile-flags: --crate-type=lib
#![feature(custom_mir, core_intrinsics, inline_const)]
#![feature(custom_mir, core_intrinsics)]
use std::intrinsics::mir::*;
// EMIT_MIR operators.f.built.after.mir

View file

@ -4,7 +4,6 @@
// Verify that we can pretty print invalid constants.
#![feature(adt_const_params)]
#![feature(inline_const)]
#![allow(incomplete_features)]
#[derive(Copy, Clone)]

View file

@ -1,6 +1,5 @@
//@ pp-exact
#![feature(inline_const)]
#![feature(inline_const_pat)]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]

View file

@ -1,4 +1,4 @@
#![feature(inline_const, generic_const_exprs)]
#![feature(generic_const_exprs)]
//~^ WARN the feature `generic_const_exprs` is incomplete
fn foo<T>() {

View file

@ -1,8 +1,8 @@
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-block-is-poly.rs:1:26
--> $DIR/const-block-is-poly.rs:1:12
|
LL | #![feature(inline_const, generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
LL | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default

View file

@ -1,5 +1,5 @@
//@ check-pass
#![feature(inline_const, generic_const_exprs)]
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
use std::marker::PhantomData;

View file

@ -1,7 +1,6 @@
//@ check-pass
#![feature(generic_const_exprs)]
#![feature(inline_const)]
#![allow(incomplete_features)]
pub struct ConstDefaultUnstable<const N: usize = { const { 3 } }>;

View file

@ -1,7 +1,5 @@
//@ run-pass
#![feature(inline_const)]
// Makes sure we don't propagate generic instances of `Self: ?Sized` blanket impls.
// This is relevant when we have an overlapping impl and builtin dyn instance.
// See <https://github.com/rust-lang/rust/pull/114941> for more context.

View file

@ -1,6 +1,5 @@
// Regression test for issue 90013.
//@ check-pass
#![feature(inline_const)]
fn main() {
const { || {} };

View file

@ -1,7 +1,7 @@
//@ known-bug: #103507
#![allow(unused)]
#![feature(const_trait_impl, inline_const, negative_impls)]
#![feature(const_trait_impl, negative_impls)]
use std::marker::Destruct;

View file

@ -1,6 +1,5 @@
//@ run-pass
#![feature(inline_const)]
#![allow(unused)]
// Some type that is not copyable.

View file

@ -1,7 +1,6 @@
//@ run-pass
#![feature(core_intrinsics)]
#![feature(const_heap)]
#![feature(inline_const)]
use std::intrinsics;

View file

@ -1,7 +1,6 @@
//@ run-pass
#![feature(core_intrinsics)]
#![feature(const_heap)]
#![feature(inline_const)]
use std::intrinsics;

View file

@ -1,4 +1,4 @@
#![feature(inline_const, const_type_id)]
#![feature(const_type_id)]
use std::alloc::Layout;
use std::any::TypeId;

View file

@ -1,6 +0,0 @@
fn main() {
let _ = const {
//~^ ERROR inline-const is experimental [E0658]
true
};
}

View file

@ -1,13 +0,0 @@
error[E0658]: inline-const is experimental
--> $DIR/feature-gate-inline_const.rs:2:13
|
LL | let _ = const {
| ^^^^^
|
= note: see issue #76001 <https://github.com/rust-lang/rust/issues/76001> for more information
= help: add `#![feature(inline_const)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -3,7 +3,6 @@
#![feature(type_alias_impl_trait)]
#![feature(const_trait_impl)]
#![feature(const_refs_to_cell)]
#![feature(inline_const)]
use std::marker::Destruct;

View file

@ -1,11 +1,11 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:25:42
--> $DIR/normalize-tait-in-const.rs:24:42
|
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^^^^^^^^^^^^
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/normalize-tait-in-const.rs:26:5
--> $DIR/normalize-tait-in-const.rs:25:5
|
LL | fun(filter_positive());
| ^^^^^^^^^^^^^^^^^^^^^^
@ -21,7 +21,7 @@ LL + #![feature(effects)]
|
error[E0493]: destructor of `F` cannot be evaluated at compile-time
--> $DIR/normalize-tait-in-const.rs:25:79
--> $DIR/normalize-tait-in-const.rs:24:79
|
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^ the destructor for this type cannot be evaluated in constant functions

View file

@ -1,7 +1,5 @@
//@ build-pass
#![feature(inline_const)]
use std::cell::Cell;
fn main() {

View file

@ -1,7 +1,5 @@
//@ run-pass
#![feature(inline_const)]
fn foo() -> i32 {
const {
let x = 5 + 10;

View file

@ -1,5 +1,4 @@
//@ build-fail
#![feature(inline_const)]
fn foo<T>() {
const { assert!(std::mem::size_of::<T>() == 0); } //~ ERROR E0080

View file

@ -1,37 +1,37 @@
error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed
--> $DIR/const-expr-generic-err.rs:5:13
--> $DIR/const-expr-generic-err.rs:4:13
|
LL | const { assert!(std::mem::size_of::<T>() == 0); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::<T>() == 0', $DIR/const-expr-generic-err.rs:5:13
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: std::mem::size_of::<T>() == 0', $DIR/const-expr-generic-err.rs:4:13
|
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> $DIR/const-expr-generic-err.rs:5:5
--> $DIR/const-expr-generic-err.rs:4:5
|
LL | const { assert!(std::mem::size_of::<T>() == 0); }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the above error was encountered while instantiating `fn foo::<i32>`
--> $DIR/const-expr-generic-err.rs:13:5
--> $DIR/const-expr-generic-err.rs:12:5
|
LL | foo::<i32>();
| ^^^^^^^^^^^^
error[E0080]: evaluation of `bar::<0>::{constant#0}` failed
--> $DIR/const-expr-generic-err.rs:9:13
--> $DIR/const-expr-generic-err.rs:8:13
|
LL | const { N - 1 }
| ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
note: erroneous constant encountered
--> $DIR/const-expr-generic-err.rs:9:5
--> $DIR/const-expr-generic-err.rs:8:5
|
LL | const { N - 1 }
| ^^^^^^^^^^^^^^^
note: erroneous constant encountered
--> $DIR/const-expr-generic-err.rs:9:5
--> $DIR/const-expr-generic-err.rs:8:5
|
LL | const { N - 1 }
| ^^^^^^^^^^^^^^^
@ -39,7 +39,7 @@ LL | const { N - 1 }
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
note: the above error was encountered while instantiating `fn bar::<0>`
--> $DIR/const-expr-generic-err.rs:14:5
--> $DIR/const-expr-generic-err.rs:13:5
|
LL | bar::<0>();
| ^^^^^^^^^^

View file

@ -1,5 +1,3 @@
#![feature(inline_const)]
fn foo<T>() {
let _ = [0u8; const { std::mem::size_of::<T>() }];
//~^ ERROR: constant expression depends on a generic parameter

View file

@ -1,5 +1,5 @@
error: constant expression depends on a generic parameter
--> $DIR/const-expr-generic-err2.rs:4:19
--> $DIR/const-expr-generic-err2.rs:2:19
|
LL | let _ = [0u8; const { std::mem::size_of::<T>() }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,4 @@
//@ check-pass
#![feature(inline_const)]
fn foo<T>() -> usize {
const { std::mem::size_of::<T>() }

View file

@ -1,7 +1,5 @@
//@ check-pass
#![feature(inline_const)]
pub fn todo<T>() -> T {
const { todo!() }
}

View file

@ -1,5 +1,4 @@
#![feature(const_mut_refs)]
#![feature(inline_const)]
use std::marker::PhantomData;

View file

@ -1,5 +1,5 @@
error[E0597]: `y` does not live long enough
--> $DIR/const-expr-lifetime-err.rs:23:30
--> $DIR/const-expr-lifetime-err.rs:22:30
|
LL | fn foo<'a>() {
| -- lifetime `'a` defined here

View file

@ -1,7 +1,6 @@
//@ run-pass
#![feature(const_mut_refs)]
#![feature(inline_const)]
use std::marker::PhantomData;

View file

@ -1,7 +1,5 @@
//@ run-pass
#![feature(inline_const)]
macro_rules! do_const_block{
($val:block) => { const $val }
}

View file

@ -1,7 +1,5 @@
//@ run-pass
#![feature(inline_const)]
const fn bar() -> i32 {
const {
2 + 3

View file

@ -1,7 +1,6 @@
//@ run-pass
#![feature(const_mut_refs)]
#![feature(inline_const)]
#![feature(inline_const_pat)]
use std::marker::PhantomData;

View file

@ -1,7 +1,5 @@
//@ check-pass
#![feature(inline_const)]
fn main() {
let _my_usize = const {
let a = 10_usize;

View file

@ -1,4 +1,3 @@
#![feature(inline_const)]
const unsafe fn require_unsafe() -> usize {
1
}

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
--> $DIR/expr-unsafe-err.rs:8:9
--> $DIR/expr-unsafe-err.rs:7:9
|
LL | require_unsafe();
| ^^^^^^^^^^^^^^^^ call to unsafe function

View file

@ -1,7 +1,7 @@
//@ check-pass
#![warn(unused_unsafe)]
#![feature(inline_const)]
const unsafe fn require_unsafe() -> usize { 1 }
fn main() {

View file

@ -1,5 +1,3 @@
#![feature(inline_const)]
fn main() {
const { 2 } - const { 1 };
//~^ ERROR mismatched types

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/expr-with-block-err.rs:4:13
--> $DIR/expr-with-block-err.rs:2:13
|
LL | const { 2 } - const { 1 };
| ^ expected `()`, found integer

View file

@ -1,5 +1,5 @@
//@ check-pass
#![feature(inline_const)]
fn main() {
match true {
true => const {}

View file

@ -1,8 +1,6 @@
//@ check-pass
// issue: 114660
#![feature(inline_const)]
fn main() {
const { core::mem::transmute::<u8, u8> };
// Don't resolve the instance of this inline constant to be an intrinsic,

View file

@ -1,7 +1,5 @@
//@ check-pass
#![feature(inline_const)]
// This used to be unsupported since the parser first tries to check if we have
// any nested items, and then checks for statements (and expressions). The heuristic
// that we were using to detect the beginning of a const item was incorrect, so

View file

@ -1,4 +1,3 @@
#![feature(inline_const)]
#![allow(arithmetic_overflow, unconditional_panic)]
// The only way to have promoteds that fail is in `const fn` called from `const`/`static`.

View file

@ -1,5 +1,5 @@
error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:17:37
--> $DIR/promotion.rs:16:37
|
LL | let _x: &'static i32 = &div_by_zero();
| ------------ ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use

View file

@ -1,6 +1,5 @@
//@ build-fail
//@ compile-flags: -Zmir-opt-level=3
#![feature(inline_const)]
fn foo<T>() {
if false {

View file

@ -1,13 +1,13 @@
error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed
--> $DIR/required-const.rs:7:17
--> $DIR/required-const.rs:6:17
|
LL | const { panic!() }
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/required-const.rs:7:17
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/required-const.rs:6:17
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> $DIR/required-const.rs:7:9
--> $DIR/required-const.rs:6:9
|
LL | const { panic!() }
| ^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
#![feature(inline_const)]
struct S<'a>(&'a u8);
fn foo() {}

View file

@ -1,11 +1,11 @@
error[E0106]: missing lifetime specifier
--> $DIR/unusual-rib-combinations.rs:24:15
--> $DIR/unusual-rib-combinations.rs:22:15
|
LL | fn d<const C: S>() {}
| ^ expected named lifetime parameter
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/unusual-rib-combinations.rs:29:22
--> $DIR/unusual-rib-combinations.rs:27:22
|
LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
| ^^ the type must not depend on the parameter `'a`
@ -13,25 +13,25 @@ LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
= note: lifetime parameters may not be used in the type of const parameters
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/unusual-rib-combinations.rs:7:16
--> $DIR/unusual-rib-combinations.rs:5:16
|
LL | fn a() -> [u8; foo::()] {
| ^^^^^^^ only `Fn` traits may use parentheses
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/unusual-rib-combinations.rs:14:15
--> $DIR/unusual-rib-combinations.rs:12:15
|
LL | fn b<const C: u8()>() {}
| ^^^^ only `Fn` traits may use parentheses
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/unusual-rib-combinations.rs:18:10
--> $DIR/unusual-rib-combinations.rs:16:10
|
LL | fn c<T = u8()>() {}
| ^^^^ only `Fn` traits may use parentheses
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
--> $DIR/unusual-rib-combinations.rs:18:6
--> $DIR/unusual-rib-combinations.rs:16:6
|
LL | fn c<T = u8()>() {}
| ^^^^^^^^
@ -41,7 +41,7 @@ LL | fn c<T = u8()>() {}
= note: `#[deny(invalid_type_param_default)]` on by default
error[E0308]: mismatched types
--> $DIR/unusual-rib-combinations.rs:7:16
--> $DIR/unusual-rib-combinations.rs:5:16
|
LL | fn a() -> [u8; foo::()] {
| ^^^^^^^ expected `usize`, found fn item
@ -50,7 +50,7 @@ LL | fn a() -> [u8; foo::()] {
found fn item `fn() {foo}`
error: `S<'_>` is forbidden as the type of a const generic parameter
--> $DIR/unusual-rib-combinations.rs:24:15
--> $DIR/unusual-rib-combinations.rs:22:15
|
LL | fn d<const C: S>() {}
| ^

View file

@ -1,6 +1,5 @@
//@ check-pass
#![feature(inline_const)]
#![feature(concat_bytes)]
#![warn(invalid_from_utf8_unchecked)]

View file

@ -1,5 +1,5 @@
warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:21:9
--> $DIR/invalid_from_utf8.rs:20:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -7,13 +7,13 @@ LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112
| the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
--> $DIR/invalid_from_utf8.rs:6:9
--> $DIR/invalid_from_utf8.rs:5:9
|
LL | #![warn(invalid_from_utf8_unchecked)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:23:9
--> $DIR/invalid_from_utf8.rs:22:9
|
LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -21,7 +21,7 @@ LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i',
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:41:9
--> $DIR/invalid_from_utf8.rs:40:9
|
LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -29,7 +29,7 @@ LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:43:9
--> $DIR/invalid_from_utf8.rs:42:9
|
LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -37,7 +37,7 @@ LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:45:9
--> $DIR/invalid_from_utf8.rs:44:9
|
LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
@ -45,7 +45,7 @@ LL | std::str::from_utf8_unchecked(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
--> $DIR/invalid_from_utf8.rs:47:9
--> $DIR/invalid_from_utf8.rs:46:9
|
LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
@ -53,7 +53,7 @@ LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:64:9
--> $DIR/invalid_from_utf8.rs:63:9
|
LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -61,13 +61,13 @@ LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
|
note: the lint level is defined here
--> $DIR/invalid_from_utf8.rs:7:9
--> $DIR/invalid_from_utf8.rs:6:9
|
LL | #![warn(invalid_from_utf8)]
| ^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:66:9
--> $DIR/invalid_from_utf8.rs:65:9
|
LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -75,7 +75,7 @@ LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p'
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:84:9
--> $DIR/invalid_from_utf8.rs:83:9
|
LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
| ^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@ -83,7 +83,7 @@ LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:86:9
--> $DIR/invalid_from_utf8.rs:85:9
|
LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
| ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
@ -91,7 +91,7 @@ LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y'])
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:88:9
--> $DIR/invalid_from_utf8.rs:87:9
|
LL | std::str::from_utf8(b"cl\x82ippy");
| ^^^^^^^^^^^^^^^^^^^^-------------^
@ -99,7 +99,7 @@ LL | std::str::from_utf8(b"cl\x82ippy");
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:90:9
--> $DIR/invalid_from_utf8.rs:89:9
|
LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| ^^^^^^^^^^^^^^^^^^^^---------------------------------^
@ -107,7 +107,7 @@ LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
| the literal was valid UTF-8 up to the 2 bytes
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:97:5
--> $DIR/invalid_from_utf8.rs:96:5
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -115,7 +115,7 @@ LL | std::str::from_utf8_mut(&mut a);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:101:5
--> $DIR/invalid_from_utf8.rs:100:5
|
LL | let mut a = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -124,7 +124,7 @@ LL | std::str::from_utf8_mut(c);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:104:5
--> $DIR/invalid_from_utf8.rs:103:5
|
LL | let mut c = &[99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -132,7 +132,7 @@ LL | std::str::from_utf8(c);
| ^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:107:5
--> $DIR/invalid_from_utf8.rs:106:5
|
LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -140,7 +140,7 @@ LL | std::str::from_utf8(&INVALID_1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:110:5
--> $DIR/invalid_from_utf8.rs:109:5
|
LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -148,7 +148,7 @@ LL | std::str::from_utf8(&INVALID_2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:113:5
--> $DIR/invalid_from_utf8.rs:112:5
|
LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@ -156,7 +156,7 @@ LL | std::str::from_utf8(INVALID_3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: calls to `std::str::from_utf8` with a invalid literal always return an error
--> $DIR/invalid_from_utf8.rs:116:5
--> $DIR/invalid_from_utf8.rs:115:5
|
LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
| ---------------------------------- the literal was valid UTF-8 up to the 2 bytes

View file

@ -2,8 +2,6 @@
//@ edition:2021
//@ rustc-env:CARGO_CRATE_NAME=non_local_def
#![feature(inline_const)]
struct Test;
trait Uto {}

View file

@ -1,5 +1,5 @@
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:15:5
--> $DIR/consts.rs:13:5
|
LL | const Z: () = {
| - help: use a const-anon item to suppress this lint: `_`
@ -14,7 +14,7 @@ LL | impl Uto for &Test {}
= note: `#[warn(non_local_definitions)]` on by default
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:26:5
--> $DIR/consts.rs:24:5
|
LL | impl Uto2 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | impl Uto2 for Test {}
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:34:5
--> $DIR/consts.rs:32:5
|
LL | impl Uto3 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^
@ -36,7 +36,7 @@ LL | impl Uto3 for Test {}
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:45:5
--> $DIR/consts.rs:43:5
|
LL | / impl Test {
LL | |
@ -50,7 +50,7 @@ LL | | }
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:52:9
--> $DIR/consts.rs:50:9
|
LL | / impl Test {
LL | |
@ -64,7 +64,7 @@ LL | | }
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:61:9
--> $DIR/consts.rs:59:9
|
LL | / impl Test {
LL | |
@ -78,7 +78,7 @@ LL | | }
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:74:9
--> $DIR/consts.rs:72:9
|
LL | impl Uto9 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^
@ -89,7 +89,7 @@ LL | impl Uto9 for Test {}
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/consts.rs:81:9
--> $DIR/consts.rs:79:9
|
LL | impl Uto10 for Test {}
| ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,8 +1,6 @@
//@ check-pass
//@ edition:2021
#![feature(inline_const)]
struct Cat;
struct Wrap<T>(T);

View file

@ -1,5 +1,5 @@
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/from-local-for-global.rs:10:5
--> $DIR/from-local-for-global.rs:8:5
|
LL | / impl From<Cat> for () {
LL | |
@ -16,7 +16,7 @@ LL | | }
= note: `#[warn(non_local_definitions)]` on by default
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/from-local-for-global.rs:20:5
--> $DIR/from-local-for-global.rs:18:5
|
LL | / impl From<Wrap<Wrap<Elephant>>> for () {
LL | |
@ -32,7 +32,7 @@ LL | | }
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/from-local-for-global.rs:34:5
--> $DIR/from-local-for-global.rs:32:5
|
LL | impl StillNonLocal for &Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -43,7 +43,7 @@ LL | impl StillNonLocal for &Foo {}
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/from-local-for-global.rs:42:5
--> $DIR/from-local-for-global.rs:40:5
|
LL | / impl From<Local1> for GlobalSameFunction {
LL | |
@ -59,7 +59,7 @@ LL | | }
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
warning: non-local `impl` definition, they should be avoided as they go against expectation
--> $DIR/from-local-for-global.rs:50:5
--> $DIR/from-local-for-global.rs:48:5
|
LL | / impl From<Local2> for GlobalSameFunction {
LL | |

View file

@ -1,7 +1,5 @@
//@ edition:2021
#![feature(inline_const)]
fn closure() {
loop {
let closure = || {

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:9:17
--> $DIR/dont-suggest-break-thru-item.rs:7:17
|
LL | / if true {
LL | | Err(1)
@ -17,7 +17,7 @@ LL | return Err(1);
| ++++++ +
error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:23:17
--> $DIR/dont-suggest-break-thru-item.rs:21:17
|
LL | / if true {
LL | | Err(1)
@ -35,7 +35,7 @@ LL | return Err(1);
| ++++++ +
error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:37:17
--> $DIR/dont-suggest-break-thru-item.rs:35:17
|
LL | / if true {
LL | | Err(1)
@ -48,7 +48,7 @@ LL | | }
found enum `Result<_, {integer}>`
error[E0308]: mismatched types
--> $DIR/dont-suggest-break-thru-item.rs:49:17
--> $DIR/dont-suggest-break-thru-item.rs:47:17
|
LL | / if true {
LL | | Err(1)

View file

@ -1,4 +1,3 @@
#![feature(inline_const)]
#![feature(yeet_expr)]
#![allow(incomplete_features)] // Necessary for now, while explicit_tail_calls is incomplete
#![feature(explicit_tail_calls)]

View file

@ -1,5 +1,5 @@
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:10:5
--> $DIR/bad-let-else-statement.rs:9:5
|
LL | } else {
| ^
@ -13,7 +13,7 @@ LL ~ }) else {
|
error: `for...else` loops are not supported
--> $DIR/bad-let-else-statement.rs:19:7
--> $DIR/bad-let-else-statement.rs:18:7
|
LL | let foo = for i in 1..2 {
| --- `else` is attached to this loop
@ -28,7 +28,7 @@ LL | | };
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:31:5
--> $DIR/bad-let-else-statement.rs:30:5
|
LL | } else {
| ^
@ -43,7 +43,7 @@ LL ~ }) else {
|
error: `loop...else` loops are not supported
--> $DIR/bad-let-else-statement.rs:40:7
--> $DIR/bad-let-else-statement.rs:39:7
|
LL | let foo = loop {
| ---- `else` is attached to this loop
@ -58,7 +58,7 @@ LL | | };
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:51:5
--> $DIR/bad-let-else-statement.rs:50:5
|
LL | } else {
| ^
@ -73,7 +73,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:62:5
--> $DIR/bad-let-else-statement.rs:61:5
|
LL | } else {
| ^
@ -87,7 +87,7 @@ LL ~ }) else {
|
error: `while...else` loops are not supported
--> $DIR/bad-let-else-statement.rs:71:7
--> $DIR/bad-let-else-statement.rs:70:7
|
LL | let foo = while false {
| ----- `else` is attached to this loop
@ -102,7 +102,7 @@ LL | | };
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:81:5
--> $DIR/bad-let-else-statement.rs:80:5
|
LL | } else {
| ^
@ -116,7 +116,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:91:5
--> $DIR/bad-let-else-statement.rs:90:5
|
LL | } else {
| ^
@ -130,7 +130,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:102:5
--> $DIR/bad-let-else-statement.rs:101:5
|
LL | } else {
| ^
@ -144,7 +144,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:112:5
--> $DIR/bad-let-else-statement.rs:111:5
|
LL | } else {
| ^
@ -158,7 +158,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:122:5
--> $DIR/bad-let-else-statement.rs:121:5
|
LL | } else {
| ^
@ -172,7 +172,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:132:5
--> $DIR/bad-let-else-statement.rs:131:5
|
LL | } else {
| ^
@ -186,7 +186,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:142:5
--> $DIR/bad-let-else-statement.rs:141:5
|
LL | } else {
| ^
@ -200,7 +200,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:152:5
--> $DIR/bad-let-else-statement.rs:151:5
|
LL | } else {
| ^
@ -214,7 +214,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:162:5
--> $DIR/bad-let-else-statement.rs:161:5
|
LL | } else {
| ^
@ -228,7 +228,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:172:5
--> $DIR/bad-let-else-statement.rs:171:5
|
LL | } else {
| ^
@ -242,7 +242,7 @@ LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:182:31
--> $DIR/bad-let-else-statement.rs:181:31
|
LL | let bad = format_args! {""} else { return; };
| ^
@ -253,7 +253,7 @@ LL | let bad = format_args! ("") else { return; };
| ~ ~
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:199:25
--> $DIR/bad-let-else-statement.rs:198:25
|
LL | let x = a! {} else { return; };
| ^
@ -268,7 +268,7 @@ LL | let x = a! () else { return; };
| ~~
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:7:5
--> $DIR/bad-let-else-statement.rs:6:5
|
LL | / let foo = {
LL | |
@ -281,7 +281,7 @@ LL | | } else {
= note: `#[warn(irrefutable_let_patterns)]` on by default
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:26:5
--> $DIR/bad-let-else-statement.rs:25:5
|
LL | / let foo = if true {
LL | |
@ -295,7 +295,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:47:5
--> $DIR/bad-let-else-statement.rs:46:5
|
LL | / let foo = match true {
LL | |
@ -308,7 +308,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:59:5
--> $DIR/bad-let-else-statement.rs:58:5
|
LL | / let foo = X {
LL | |
@ -320,7 +320,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:78:5
--> $DIR/bad-let-else-statement.rs:77:5
|
LL | / let foo = const {
LL | |
@ -332,7 +332,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:88:5
--> $DIR/bad-let-else-statement.rs:87:5
|
LL | / let foo = &{
LL | |
@ -344,7 +344,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:99:5
--> $DIR/bad-let-else-statement.rs:98:5
|
LL | / let foo = bar = {
LL | |
@ -356,7 +356,7 @@ LL | | } else {
= help: consider removing the `else` clause
error[E0384]: cannot assign twice to immutable variable `bar`
--> $DIR/bad-let-else-statement.rs:99:15
--> $DIR/bad-let-else-statement.rs:98:15
|
LL | let bar = 0;
| ---
@ -371,7 +371,7 @@ LL | | } else {
| |_____^ cannot assign twice to immutable variable
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:109:5
--> $DIR/bad-let-else-statement.rs:108:5
|
LL | / let foo = 1 + {
LL | |
@ -383,7 +383,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:119:5
--> $DIR/bad-let-else-statement.rs:118:5
|
LL | / let foo = 1..{
LL | |
@ -395,7 +395,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:129:5
--> $DIR/bad-let-else-statement.rs:128:5
|
LL | / let foo = return {
LL | |
@ -407,7 +407,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:139:5
--> $DIR/bad-let-else-statement.rs:138:5
|
LL | / let foo = -{
LL | |
@ -419,7 +419,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:149:5
--> $DIR/bad-let-else-statement.rs:148:5
|
LL | / let foo = do yeet {
LL | |
@ -431,7 +431,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:159:5
--> $DIR/bad-let-else-statement.rs:158:5
|
LL | / let foo = become {
LL | |
@ -443,7 +443,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:169:5
--> $DIR/bad-let-else-statement.rs:168:5
|
LL | / let foo = |x: i32| {
LL | |
@ -455,7 +455,7 @@ LL | | } else {
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:179:5
--> $DIR/bad-let-else-statement.rs:178:5
|
LL | let ok = format_args!("") else { return; };
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -464,7 +464,7 @@ LL | let ok = format_args!("") else { return; };
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:182:5
--> $DIR/bad-let-else-statement.rs:181:5
|
LL | let bad = format_args! {""} else { return; };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -473,7 +473,7 @@ LL | let bad = format_args! {""} else { return; };
= help: consider removing the `else` clause
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:189:19
--> $DIR/bad-let-else-statement.rs:188:19
|
LL | () => { {} }
| ___________________^
@ -493,7 +493,7 @@ LL | b!(1); b!(2);
= note: this warning originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: irrefutable `let...else` pattern
--> $DIR/bad-let-else-statement.rs:189:19
--> $DIR/bad-let-else-statement.rs:188:19
|
LL | () => { {} }
| ___________________^

View file

@ -5,7 +5,7 @@
#![feature(generic_arg_infer)]
#![feature(core_intrinsics)]
#![feature(repr_simd)]
#![feature(inline_const)]
use std::intrinsics::simd::*;
#[repr(simd)]

View file

@ -2,7 +2,6 @@
//@ ignore-emscripten FIXME(#45351) hits an LLVM assert
#![feature(repr_simd, intrinsics)]
#![feature(inline_const)]
#[repr(simd)]
#[derive(Copy, Clone, Debug, PartialEq)]