mirror of https://github.com/rust-lang/rust.git
stabilize raw_ref_op
This commit is contained in:
parent
f04f6ca36d
commit
79503dd742
|
@ -539,7 +539,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
|
|||
}
|
||||
}
|
||||
gate_all!(gen_blocks, "gen blocks are experimental");
|
||||
gate_all!(raw_ref_op, "raw address of syntax is experimental");
|
||||
gate_all!(const_trait_impl, "const trait impls are experimental");
|
||||
gate_all!(
|
||||
half_open_range_patterns_in_slices,
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
extern_types,
|
||||
naked_functions,
|
||||
thread_local,
|
||||
repr_simd,
|
||||
raw_ref_op
|
||||
repr_simd
|
||||
)]
|
||||
#![no_core]
|
||||
#![allow(dead_code, non_camel_case_types, internal_features)]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#![feature(
|
||||
no_core, unboxed_closures, start, lang_items, never_type, linkage,
|
||||
extern_types, thread_local, raw_ref_op
|
||||
extern_types, thread_local
|
||||
)]
|
||||
#![no_core]
|
||||
#![allow(dead_code, internal_features, non_camel_case_types)]
|
||||
|
|
|
@ -3,7 +3,6 @@ The address of temporary value was taken.
|
|||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0745
|
||||
# #![feature(raw_ref_op)]
|
||||
fn temp_address() {
|
||||
let ptr = &raw const 2; // error!
|
||||
}
|
||||
|
@ -15,7 +14,6 @@ In this example, `2` is destroyed right after the assignment, which means that
|
|||
To avoid this error, first bind the temporary to a named local variable:
|
||||
|
||||
```
|
||||
# #![feature(raw_ref_op)]
|
||||
fn temp_address() {
|
||||
let val = 2;
|
||||
let ptr = &raw const val; // ok!
|
||||
|
|
|
@ -321,6 +321,8 @@ declare_features! (
|
|||
(accepted, raw_dylib, "1.71.0", Some(58713)),
|
||||
/// Allows keywords to be escaped for use as identifiers.
|
||||
(accepted, raw_identifiers, "1.30.0", Some(48589)),
|
||||
/// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions.
|
||||
(accepted, raw_ref_op, "CURRENT_RUSTC_VERSION", Some(64490)),
|
||||
/// Allows relaxing the coherence rules such that
|
||||
/// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
|
||||
(accepted, re_rebalance_coherence, "1.41.0", Some(55437)),
|
||||
|
|
|
@ -565,8 +565,6 @@ declare_features! (
|
|||
(unstable, precise_capturing, "1.79.0", Some(123432)),
|
||||
/// Allows macro attributes on expressions, statements and non-inline modules.
|
||||
(unstable, proc_macro_hygiene, "1.30.0", Some(54727)),
|
||||
/// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions.
|
||||
(unstable, raw_ref_op, "1.41.0", Some(64490)),
|
||||
/// Makes `&` and `&mut` patterns eat only one layer of references in Rust 2024.
|
||||
(incomplete, ref_pat_eat_one_layer_2024, "1.79.0", Some(123076)),
|
||||
/// Makes `&` and `&mut` patterns eat only one layer of references in Rust 2024—structural variant
|
||||
|
|
|
@ -851,7 +851,7 @@ impl<'a> Parser<'a> {
|
|||
self.expect_and()?;
|
||||
let has_lifetime = self.token.is_lifetime() && self.look_ahead(1, |t| t != &token::Colon);
|
||||
let lifetime = has_lifetime.then(|| self.expect_lifetime()); // For recovery, see below.
|
||||
let (borrow_kind, mutbl) = self.parse_borrow_modifiers(lo);
|
||||
let (borrow_kind, mutbl) = self.parse_borrow_modifiers();
|
||||
let attrs = self.parse_outer_attributes()?;
|
||||
let expr = if self.token.is_range_separator() {
|
||||
self.parse_expr_prefix_range(attrs)
|
||||
|
@ -871,13 +871,12 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
/// Parse `mut?` or `raw [ const | mut ]`.
|
||||
fn parse_borrow_modifiers(&mut self, lo: Span) -> (ast::BorrowKind, ast::Mutability) {
|
||||
fn parse_borrow_modifiers(&mut self) -> (ast::BorrowKind, ast::Mutability) {
|
||||
if self.check_keyword(kw::Raw) && self.look_ahead(1, Token::is_mutability) {
|
||||
// `raw [ const | mut ]`.
|
||||
let found_raw = self.eat_keyword(kw::Raw);
|
||||
assert!(found_raw);
|
||||
let mutability = self.parse_const_or_mut().unwrap();
|
||||
self.psess.gated_spans.gate(sym::raw_ref_op, lo.to(self.prev_token.span));
|
||||
(ast::BorrowKind::Raw, mutability)
|
||||
} else {
|
||||
// `mut?`
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(raw_ref_op)]
|
||||
#![feature(strict_provenance)]
|
||||
use std::ptr;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//@revisions: stack tree none
|
||||
//@[tree]compile-flags: -Zmiri-tree-borrows
|
||||
//@[none]compile-flags: -Zmiri-disable-stacked-borrows
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(custom_mir)]
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// This does need an aliasing model and protectors.
|
||||
//@revisions: stack tree
|
||||
//@[tree]compile-flags: -Zmiri-tree-borrows
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(custom_mir)]
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// This does need an aliasing model and protectors.
|
||||
//@revisions: stack tree
|
||||
//@[tree]compile-flags: -Zmiri-tree-borrows
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(custom_mir)]
|
||||
#![feature(explicit_tail_calls)]
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Doesn't need an aliasing model.
|
||||
//@compile-flags: -Zmiri-disable-stacked-borrows
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(custom_mir)]
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(raw_ref_op)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(custom_mir)]
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//@ test-mir-pass: GVN
|
||||
// Check that we do not propagate past an indirect mutation.
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
// EMIT_MIR indirect_mutation.foo.GVN.diff
|
||||
fn foo() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// Check that CopyProp considers reborrows as not mutating the pointer.
|
||||
//@ test-mir-pass: CopyProp
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
#[inline(never)]
|
||||
fn opaque(_: impl Sized) {}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
let mut _3: fn(u8) -> u8;
|
||||
let _5: ();
|
||||
let mut _6: fn(u8) -> u8;
|
||||
let mut _9: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
let _10: ();
|
||||
let mut _11: fn();
|
||||
let mut _13: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
let _14: ();
|
||||
let mut _15: fn();
|
||||
scope 1 {
|
||||
|
@ -19,7 +19,7 @@
|
|||
let _4: fn(u8) -> u8;
|
||||
scope 2 {
|
||||
debug g => _4;
|
||||
let _7: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
let _7: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
scope 3 {
|
||||
debug closure => _7;
|
||||
let _8: fn();
|
||||
|
@ -62,16 +62,16 @@
|
|||
StorageDead(_6);
|
||||
StorageDead(_5);
|
||||
- StorageLive(_7);
|
||||
- _7 = {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
- _7 = {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
- StorageLive(_8);
|
||||
+ nop;
|
||||
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
+ nop;
|
||||
StorageLive(_9);
|
||||
- _9 = _7;
|
||||
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
StorageDead(_9);
|
||||
StorageLive(_10);
|
||||
StorageLive(_11);
|
||||
|
@ -88,8 +88,8 @@
|
|||
StorageLive(_13);
|
||||
- _13 = _7;
|
||||
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
StorageDead(_13);
|
||||
StorageLive(_14);
|
||||
StorageLive(_15);
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
let mut _3: fn(u8) -> u8;
|
||||
let _5: ();
|
||||
let mut _6: fn(u8) -> u8;
|
||||
let mut _9: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
let _10: ();
|
||||
let mut _11: fn();
|
||||
let mut _13: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
let _14: ();
|
||||
let mut _15: fn();
|
||||
scope 1 {
|
||||
|
@ -19,7 +19,7 @@
|
|||
let _4: fn(u8) -> u8;
|
||||
scope 2 {
|
||||
debug g => _4;
|
||||
let _7: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
let _7: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
scope 3 {
|
||||
debug closure => _7;
|
||||
let _8: fn();
|
||||
|
@ -62,16 +62,16 @@
|
|||
StorageDead(_6);
|
||||
StorageDead(_5);
|
||||
- StorageLive(_7);
|
||||
- _7 = {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
- _7 = {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
- StorageLive(_8);
|
||||
+ nop;
|
||||
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
+ nop;
|
||||
StorageLive(_9);
|
||||
- _9 = _7;
|
||||
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
StorageDead(_9);
|
||||
StorageLive(_10);
|
||||
StorageLive(_11);
|
||||
|
@ -88,8 +88,8 @@
|
|||
StorageLive(_13);
|
||||
- _13 = _7;
|
||||
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21};
|
||||
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21};
|
||||
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe)));
|
||||
StorageDead(_13);
|
||||
StorageLive(_14);
|
||||
StorageLive(_15);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
//@ only-64bit
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(custom_mir)]
|
||||
#![feature(core_intrinsics)]
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//@ test-mir-pass: InstSimplify-after-simplifycfg
|
||||
#![crate_type = "lib"]
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
// For each of these, only 2 of the 6 should simplify,
|
||||
// as the others have the wrong types.
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//@ test-mir-pass: ReferencePropagation
|
||||
//@ needs-unwind
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(core_intrinsics, custom_mir)]
|
||||
|
||||
#[inline(never)]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//@ pp-exact
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
const C_PTR: () = { let a = 1; &raw const a; };
|
||||
static S_PTR: () = { let b = false; &raw const b; };
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(raw_ref_op)]
|
||||
|
||||
fn address_of_shared() {
|
||||
let mut x = 0;
|
||||
let y = &x;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrow-raw-address-of-borrowed.rs:7:13
|
||||
--> $DIR/borrow-raw-address-of-borrowed.rs:5:13
|
||||
|
|
||||
LL | let y = &x;
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -11,7 +11,7 @@ LL | drop(y);
|
|||
| - immutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrow-raw-address-of-borrowed.rs:16:13
|
||||
--> $DIR/borrow-raw-address-of-borrowed.rs:14:13
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -23,7 +23,7 @@ LL | drop(y);
|
|||
| - mutable borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrow-raw-address-of-borrowed.rs:17:13
|
||||
--> $DIR/borrow-raw-address-of-borrowed.rs:15:13
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ first mutable borrow occurs here
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
fn raw_reborrow() {
|
||||
let x = &0;
|
||||
let y = &mut 0;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Check that `&raw mut` cannot be used to turn a `&T` into a `*mut T`.
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
fn raw_reborrow() {
|
||||
let x = &0;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
|
||||
--> $DIR/borrow-raw-address-of-deref-mutability.rs:8:13
|
||||
--> $DIR/borrow-raw-address-of-deref-mutability.rs:6:13
|
||||
|
|
||||
LL | let q = &raw mut *x;
|
||||
| ^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
||||
|
@ -10,7 +10,7 @@ LL | let x = &mut 0;
|
|||
| +++
|
||||
|
||||
error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer
|
||||
--> $DIR/borrow-raw-address-of-deref-mutability.rs:14:13
|
||||
--> $DIR/borrow-raw-address-of-deref-mutability.rs:12:13
|
||||
|
|
||||
LL | let q = &raw mut *x;
|
||||
| ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
fn mutable_address_of() {
|
||||
let mut x = 0;
|
||||
let y = &raw mut x;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(raw_ref_op)]
|
||||
|
||||
fn mutable_address_of() {
|
||||
let x = 0;
|
||||
let y = &raw mut x; //~ ERROR cannot borrow
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:5:13
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:3:13
|
||||
|
|
||||
LL | let y = &raw mut x;
|
||||
| ^^^^^^^^^^ cannot borrow as mutable
|
||||
|
@ -10,7 +10,7 @@ LL | let mut x = 0;
|
|||
| +++
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:11:17
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:9:17
|
||||
|
|
||||
LL | let y = &raw mut x;
|
||||
| ^^^^^^^^^^ cannot borrow as mutable
|
||||
|
@ -21,7 +21,7 @@ LL | let mut x = 0;
|
|||
| +++
|
||||
|
||||
error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:21:5
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:19:5
|
||||
|
|
||||
LL | let y = &raw mut x;
|
||||
| - calling `f` requires mutable binding due to mutable borrow of `x`
|
||||
|
@ -35,7 +35,7 @@ LL | let mut f = || {
|
|||
| +++
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:29:17
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:27:17
|
||||
|
|
||||
LL | fn make_fn<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
|
@ -48,7 +48,7 @@ LL | let y = &raw mut x;
|
|||
| ^^^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:37:17
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:35:17
|
||||
|
|
||||
LL | fn make_fn<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(raw_ref_op)]
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
const A: () = { let x = Cell::new(2); &raw const x; }; //~ ERROR interior mutability
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability
|
||||
--> $DIR/const-address-of-interior-mut.rs:5:39
|
||||
--> $DIR/const-address-of-interior-mut.rs:3:39
|
||||
|
|
||||
LL | const A: () = { let x = Cell::new(2); &raw const x; };
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -9,7 +9,7 @@ LL | const A: () = { let x = Cell::new(2); &raw const x; };
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability
|
||||
--> $DIR/const-address-of-interior-mut.rs:7:40
|
||||
--> $DIR/const-address-of-interior-mut.rs:5:40
|
||||
|
|
||||
LL | static B: () = { let x = Cell::new(2); &raw const x; };
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -19,7 +19,7 @@ LL | static B: () = { let x = Cell::new(2); &raw const x; };
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability
|
||||
--> $DIR/const-address-of-interior-mut.rs:9:44
|
||||
--> $DIR/const-address-of-interior-mut.rs:7:44
|
||||
|
|
||||
LL | static mut C: () = { let x = Cell::new(2); &raw const x; };
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -29,7 +29,7 @@ LL | static mut C: () = { let x = Cell::new(2); &raw const x; };
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability
|
||||
--> $DIR/const-address-of-interior-mut.rs:13:13
|
||||
--> $DIR/const-address-of-interior-mut.rs:11:13
|
||||
|
|
||||
LL | let y = &raw const x;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(raw_ref_op)]
|
||||
|
||||
const A: () = { let mut x = 2; &raw mut x; }; //~ mutable pointer
|
||||
|
||||
static B: () = { let mut x = 2; &raw mut x; }; //~ mutable pointer
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: raw mutable pointers are not allowed in constants
|
||||
--> $DIR/const-address-of-mut.rs:3:32
|
||||
--> $DIR/const-address-of-mut.rs:1:32
|
||||
|
|
||||
LL | const A: () = { let mut x = 2; &raw mut x; };
|
||||
| ^^^^^^^^^^
|
||||
|
@ -9,7 +9,7 @@ LL | const A: () = { let mut x = 2; &raw mut x; };
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: raw mutable pointers are not allowed in statics
|
||||
--> $DIR/const-address-of-mut.rs:5:33
|
||||
--> $DIR/const-address-of-mut.rs:3:33
|
||||
|
|
||||
LL | static B: () = { let mut x = 2; &raw mut x; };
|
||||
| ^^^^^^^^^^
|
||||
|
@ -19,7 +19,7 @@ LL | static B: () = { let mut x = 2; &raw mut x; };
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: raw mutable pointers are not allowed in constant functions
|
||||
--> $DIR/const-address-of-mut.rs:9:13
|
||||
--> $DIR/const-address-of-mut.rs:7:13
|
||||
|
|
||||
LL | let y = &raw mut x;
|
||||
| ^^^^^^^^^^
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
const A: *const i32 = &raw const *&2;
|
||||
static B: () = { &raw const *&2; };
|
||||
static mut C: *const i32 = &raw const *&2;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//@ check-pass
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
struct Foo {
|
||||
x: usize
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![feature(const_mut_refs)]
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
const NULL: *mut i32 = std::ptr::null_mut();
|
||||
const A: *const i32 = &4;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error[E0764]: mutable references are not allowed in the final value of constants
|
||||
--> $DIR/mut_ref_in_final.rs:10:21
|
||||
--> $DIR/mut_ref_in_final.rs:9:21
|
||||
|
|
||||
LL | const B: *mut i32 = &mut 4;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/mut_ref_in_final.rs:16:40
|
||||
--> $DIR/mut_ref_in_final.rs:15:40
|
||||
|
|
||||
LL | const B3: Option<&mut i32> = Some(&mut 42);
|
||||
| ----------^^-
|
||||
|
@ -15,7 +15,7 @@ LL | const B3: Option<&mut i32> = Some(&mut 42);
|
|||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/mut_ref_in_final.rs:19:42
|
||||
--> $DIR/mut_ref_in_final.rs:18:42
|
||||
|
|
||||
LL | const B4: Option<&mut i32> = helper(&mut 42);
|
||||
| ------------^^-
|
||||
|
@ -25,7 +25,7 @@ LL | const B4: Option<&mut i32> = helper(&mut 42);
|
|||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/mut_ref_in_final.rs:34:65
|
||||
--> $DIR/mut_ref_in_final.rs:33:65
|
||||
|
|
||||
LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
||||
| -------------------------------^^--
|
||||
|
@ -35,7 +35,7 @@ LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
|||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/mut_ref_in_final.rs:37:67
|
||||
--> $DIR/mut_ref_in_final.rs:36:67
|
||||
|
|
||||
LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
||||
| -------------------------------^^--
|
||||
|
@ -45,7 +45,7 @@ LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
|||
| using this value as a static requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/mut_ref_in_final.rs:40:71
|
||||
--> $DIR/mut_ref_in_final.rs:39:71
|
||||
|
|
||||
LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
||||
| -------------------------------^^--
|
||||
|
@ -55,25 +55,25 @@ LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
|||
| using this value as a static requires that borrow lasts for `'static`
|
||||
|
||||
error[E0764]: mutable references are not allowed in the final value of statics
|
||||
--> $DIR/mut_ref_in_final.rs:53:53
|
||||
--> $DIR/mut_ref_in_final.rs:52:53
|
||||
|
|
||||
LL | static RAW_MUT_CAST_S: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0764]: mutable references are not allowed in the final value of statics
|
||||
--> $DIR/mut_ref_in_final.rs:55:54
|
||||
--> $DIR/mut_ref_in_final.rs:54:54
|
||||
|
|
||||
LL | static RAW_MUT_COERCE_S: SyncPtr<i32> = SyncPtr { x: &mut 0 };
|
||||
| ^^^^^^
|
||||
|
||||
error[E0764]: mutable references are not allowed in the final value of constants
|
||||
--> $DIR/mut_ref_in_final.rs:57:52
|
||||
--> $DIR/mut_ref_in_final.rs:56:52
|
||||
|
|
||||
LL | const RAW_MUT_CAST_C: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0764]: mutable references are not allowed in the final value of constants
|
||||
--> $DIR/mut_ref_in_final.rs:59:53
|
||||
--> $DIR/mut_ref_in_final.rs:58:53
|
||||
|
|
||||
LL | const RAW_MUT_COERCE_C: SyncPtr<i32> = SyncPtr { x: &mut 0 };
|
||||
| ^^^^^^
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//@ normalize-stderr-test: "( 0x[0-9a-f][0-9a-f] │)? ([0-9a-f][0-9a-f] |__ |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> " HEX_DUMP"
|
||||
//@ normalize-stderr-test: "HEX_DUMP\s*\n\s*HEX_DUMP" -> "HEX_DUMP"
|
||||
#![feature(const_mut_refs, const_refs_to_static)]
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
use std::sync::Mutex;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:20:1
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:19:1
|
||||
|
|
||||
LL | const MUT: Option<&mut i32> = helper();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered reference to mutable memory in `const`
|
||||
|
@ -10,7 +10,7 @@ LL | const MUT: Option<&mut i32> = helper();
|
|||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:27:1
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:26:1
|
||||
|
|
||||
LL | const INT2PTR: Option<&mut i32> = helper_int2ptr();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (0x2a[noalloc] has no provenance)
|
||||
|
@ -21,7 +21,7 @@ LL | const INT2PTR: Option<&mut i32> = helper_int2ptr();
|
|||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:29:1
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:28:1
|
||||
|
|
||||
LL | static INT2PTR_STATIC: Option<&mut i32> = helper_int2ptr();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (0x2a[noalloc] has no provenance)
|
||||
|
@ -32,7 +32,7 @@ LL | static INT2PTR_STATIC: Option<&mut i32> = helper_int2ptr();
|
|||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:36:1
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:35:1
|
||||
|
|
||||
LL | const DANGLING: Option<&mut i32> = helper_dangling();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (use-after-free)
|
||||
|
@ -43,7 +43,7 @@ LL | const DANGLING: Option<&mut i32> = helper_dangling();
|
|||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:37:1
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:36:1
|
||||
|
|
||||
LL | static DANGLING_STATIC: Option<&mut i32> = helper_dangling();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (use-after-free)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(raw_ref_op)]
|
||||
|
||||
const fn mutable_address_of_in_const() {
|
||||
let mut a = 0;
|
||||
let b = &raw mut a; //~ ERROR mutable pointer
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: raw mutable pointers are not allowed in constant functions
|
||||
--> $DIR/address_of.rs:5:13
|
||||
--> $DIR/address_of.rs:3:13
|
||||
|
|
||||
LL | let b = &raw mut a;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -9,7 +9,7 @@ LL | let b = &raw mut a;
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: raw mutable pointers are not allowed in constant functions
|
||||
--> $DIR/address_of.rs:13:17
|
||||
--> $DIR/address_of.rs:11:17
|
||||
|
|
||||
LL | let b = &raw mut a;
|
||||
| ^^^^^^^^^^
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
const fn const_address_of_in_const() {
|
||||
let mut a = 0;
|
||||
let b = &raw const a;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#![feature(const_mut_refs)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
#![feature(const_swap)]
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
// Mutable borrow of a field with drop impl.
|
||||
pub const fn f() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:15:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:14:9
|
||||
|
|
||||
LL | let mut x = None;
|
||||
| ^^^^^ the destructor for this type cannot be evaluated in constants
|
||||
|
@ -16,13 +16,13 @@ note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))`
|
|||
note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))`
|
||||
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
note: inside `A1`
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:21:1
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:20:1
|
||||
|
|
||||
LL | };
|
||||
| ^
|
||||
|
||||
error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:31:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:30:9
|
||||
|
|
||||
LL | let _z = x;
|
||||
| ^^ the destructor for this type cannot be evaluated in constants
|
||||
|
@ -39,49 +39,49 @@ note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))`
|
|||
note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))`
|
||||
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
note: inside `A2`
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:32:1
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:31:1
|
||||
|
|
||||
LL | };
|
||||
| ^
|
||||
|
||||
error[E0493]: destructor of `(u32, Option<String>)` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:9:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:8:9
|
||||
|
|
||||
LL | let mut a: (u32, Option<String>) = (0, None);
|
||||
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `Option<T>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:36:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:35:9
|
||||
|
|
||||
LL | let x: Option<T> = None;
|
||||
| ^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `Option<T>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:44:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:43:9
|
||||
|
|
||||
LL | let _y = x;
|
||||
| ^^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:52:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:51:9
|
||||
|
|
||||
LL | let mut y: Option<String> = None;
|
||||
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:49:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:48:9
|
||||
|
|
||||
LL | let mut x: Option<String> = None;
|
||||
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:62:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:61:9
|
||||
|
|
||||
LL | let y: Option<String> = None;
|
||||
| ^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:59:9
|
||||
--> $DIR/qualif-indirect-mutation-fail.rs:58:9
|
||||
|
|
||||
LL | let x: Option<String> = None;
|
||||
| ^ the destructor for this type cannot be evaluated in constant functions
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//@ run-rustfix
|
||||
|
||||
#![deny(unused_parens)]
|
||||
#![feature(raw_ref_op)]
|
||||
#![allow(while_true)] // for rustfix
|
||||
|
||||
#[derive(Eq, PartialEq)]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//@ run-rustfix
|
||||
|
||||
#![deny(unused_parens)]
|
||||
#![feature(raw_ref_op)]
|
||||
#![allow(while_true)] // for rustfix
|
||||
|
||||
#[derive(Eq, PartialEq)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: unnecessary parentheses around `return` value
|
||||
--> $DIR/lint-unnecessary-parens.rs:14:12
|
||||
--> $DIR/lint-unnecessary-parens.rs:13:12
|
||||
|
|
||||
LL | return (1);
|
||||
| ^ ^
|
||||
|
@ -16,7 +16,7 @@ LL + return 1;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `return` value
|
||||
--> $DIR/lint-unnecessary-parens.rs:17:12
|
||||
--> $DIR/lint-unnecessary-parens.rs:16:12
|
||||
|
|
||||
LL | return (X { y });
|
||||
| ^ ^
|
||||
|
@ -28,7 +28,7 @@ LL + return X { y };
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around type
|
||||
--> $DIR/lint-unnecessary-parens.rs:20:46
|
||||
--> $DIR/lint-unnecessary-parens.rs:19:46
|
||||
|
|
||||
LL | pub fn unused_parens_around_return_type() -> (u32) {
|
||||
| ^ ^
|
||||
|
@ -40,7 +40,7 @@ LL + pub fn unused_parens_around_return_type() -> u32 {
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around block return value
|
||||
--> $DIR/lint-unnecessary-parens.rs:26:9
|
||||
--> $DIR/lint-unnecessary-parens.rs:25:9
|
||||
|
|
||||
LL | (5)
|
||||
| ^ ^
|
||||
|
@ -52,7 +52,7 @@ LL + 5
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around block return value
|
||||
--> $DIR/lint-unnecessary-parens.rs:28:5
|
||||
--> $DIR/lint-unnecessary-parens.rs:27:5
|
||||
|
|
||||
LL | (5)
|
||||
| ^ ^
|
||||
|
@ -64,7 +64,7 @@ LL + 5
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `if` condition
|
||||
--> $DIR/lint-unnecessary-parens.rs:40:7
|
||||
--> $DIR/lint-unnecessary-parens.rs:39:7
|
||||
|
|
||||
LL | if(true) {}
|
||||
| ^ ^
|
||||
|
@ -76,7 +76,7 @@ LL + if true {}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `while` condition
|
||||
--> $DIR/lint-unnecessary-parens.rs:41:10
|
||||
--> $DIR/lint-unnecessary-parens.rs:40:10
|
||||
|
|
||||
LL | while(true) {}
|
||||
| ^ ^
|
||||
|
@ -88,7 +88,7 @@ LL + while true {}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `for` iterator expression
|
||||
--> $DIR/lint-unnecessary-parens.rs:42:13
|
||||
--> $DIR/lint-unnecessary-parens.rs:41:13
|
||||
|
|
||||
LL | for _ in(e) {}
|
||||
| ^ ^
|
||||
|
@ -100,7 +100,7 @@ LL + for _ in e {}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `match` scrutinee expression
|
||||
--> $DIR/lint-unnecessary-parens.rs:43:10
|
||||
--> $DIR/lint-unnecessary-parens.rs:42:10
|
||||
|
|
||||
LL | match(1) { _ => ()}
|
||||
| ^ ^
|
||||
|
@ -112,7 +112,7 @@ LL + match 1 { _ => ()}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `return` value
|
||||
--> $DIR/lint-unnecessary-parens.rs:44:11
|
||||
--> $DIR/lint-unnecessary-parens.rs:43:11
|
||||
|
|
||||
LL | return(1);
|
||||
| ^ ^
|
||||
|
@ -124,7 +124,7 @@ LL + return 1;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/lint-unnecessary-parens.rs:75:31
|
||||
--> $DIR/lint-unnecessary-parens.rs:74:31
|
||||
|
|
||||
LL | pub const CONST_ITEM: usize = (10);
|
||||
| ^ ^
|
||||
|
@ -136,7 +136,7 @@ LL + pub const CONST_ITEM: usize = 10;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/lint-unnecessary-parens.rs:76:33
|
||||
--> $DIR/lint-unnecessary-parens.rs:75:33
|
||||
|
|
||||
LL | pub static STATIC_ITEM: usize = (10);
|
||||
| ^ ^
|
||||
|
@ -148,7 +148,7 @@ LL + pub static STATIC_ITEM: usize = 10;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around function argument
|
||||
--> $DIR/lint-unnecessary-parens.rs:80:9
|
||||
--> $DIR/lint-unnecessary-parens.rs:79:9
|
||||
|
|
||||
LL | bar((true));
|
||||
| ^ ^
|
||||
|
@ -160,7 +160,7 @@ LL + bar(true);
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `if` condition
|
||||
--> $DIR/lint-unnecessary-parens.rs:82:8
|
||||
--> $DIR/lint-unnecessary-parens.rs:81:8
|
||||
|
|
||||
LL | if (true) {}
|
||||
| ^ ^
|
||||
|
@ -172,7 +172,7 @@ LL + if true {}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `while` condition
|
||||
--> $DIR/lint-unnecessary-parens.rs:83:11
|
||||
--> $DIR/lint-unnecessary-parens.rs:82:11
|
||||
|
|
||||
LL | while (true) {}
|
||||
| ^ ^
|
||||
|
@ -184,7 +184,7 @@ LL + while true {}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `match` scrutinee expression
|
||||
--> $DIR/lint-unnecessary-parens.rs:84:11
|
||||
--> $DIR/lint-unnecessary-parens.rs:83:11
|
||||
|
|
||||
LL | match (true) {
|
||||
| ^ ^
|
||||
|
@ -196,7 +196,7 @@ LL + match true {
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `let` scrutinee expression
|
||||
--> $DIR/lint-unnecessary-parens.rs:87:16
|
||||
--> $DIR/lint-unnecessary-parens.rs:86:16
|
||||
|
|
||||
LL | if let 1 = (1) {}
|
||||
| ^ ^
|
||||
|
@ -208,7 +208,7 @@ LL + if let 1 = 1 {}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around `let` scrutinee expression
|
||||
--> $DIR/lint-unnecessary-parens.rs:88:19
|
||||
--> $DIR/lint-unnecessary-parens.rs:87:19
|
||||
|
|
||||
LL | while let 1 = (2) {}
|
||||
| ^ ^
|
||||
|
@ -220,7 +220,7 @@ LL + while let 1 = 2 {}
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around method argument
|
||||
--> $DIR/lint-unnecessary-parens.rs:104:24
|
||||
--> $DIR/lint-unnecessary-parens.rs:103:24
|
||||
|
|
||||
LL | X { y: false }.foo((true));
|
||||
| ^ ^
|
||||
|
@ -232,7 +232,7 @@ LL + X { y: false }.foo(true);
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/lint-unnecessary-parens.rs:106:18
|
||||
--> $DIR/lint-unnecessary-parens.rs:105:18
|
||||
|
|
||||
LL | let mut _a = (0);
|
||||
| ^ ^
|
||||
|
@ -244,7 +244,7 @@ LL + let mut _a = 0;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/lint-unnecessary-parens.rs:107:10
|
||||
--> $DIR/lint-unnecessary-parens.rs:106:10
|
||||
|
|
||||
LL | _a = (0);
|
||||
| ^ ^
|
||||
|
@ -256,7 +256,7 @@ LL + _a = 0;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/lint-unnecessary-parens.rs:108:11
|
||||
--> $DIR/lint-unnecessary-parens.rs:107:11
|
||||
|
|
||||
LL | _a += (1);
|
||||
| ^ ^
|
||||
|
@ -268,7 +268,7 @@ LL + _a += 1;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around pattern
|
||||
--> $DIR/lint-unnecessary-parens.rs:110:8
|
||||
--> $DIR/lint-unnecessary-parens.rs:109:8
|
||||
|
|
||||
LL | let(mut _a) = 3;
|
||||
| ^ ^
|
||||
|
@ -280,7 +280,7 @@ LL + let mut _a = 3;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around pattern
|
||||
--> $DIR/lint-unnecessary-parens.rs:111:9
|
||||
--> $DIR/lint-unnecessary-parens.rs:110:9
|
||||
|
|
||||
LL | let (mut _a) = 3;
|
||||
| ^ ^
|
||||
|
@ -292,7 +292,7 @@ LL + let mut _a = 3;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around pattern
|
||||
--> $DIR/lint-unnecessary-parens.rs:112:8
|
||||
--> $DIR/lint-unnecessary-parens.rs:111:8
|
||||
|
|
||||
LL | let( mut _a) = 3;
|
||||
| ^^ ^
|
||||
|
@ -304,7 +304,7 @@ LL + let mut _a = 3;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around pattern
|
||||
--> $DIR/lint-unnecessary-parens.rs:114:8
|
||||
--> $DIR/lint-unnecessary-parens.rs:113:8
|
||||
|
|
||||
LL | let(_a) = 3;
|
||||
| ^ ^
|
||||
|
@ -316,7 +316,7 @@ LL + let _a = 3;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around pattern
|
||||
--> $DIR/lint-unnecessary-parens.rs:115:9
|
||||
--> $DIR/lint-unnecessary-parens.rs:114:9
|
||||
|
|
||||
LL | let (_a) = 3;
|
||||
| ^ ^
|
||||
|
@ -328,7 +328,7 @@ LL + let _a = 3;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around pattern
|
||||
--> $DIR/lint-unnecessary-parens.rs:116:8
|
||||
--> $DIR/lint-unnecessary-parens.rs:115:8
|
||||
|
|
||||
LL | let( _a) = 3;
|
||||
| ^^ ^
|
||||
|
@ -340,7 +340,7 @@ LL + let _a = 3;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around block return value
|
||||
--> $DIR/lint-unnecessary-parens.rs:122:9
|
||||
--> $DIR/lint-unnecessary-parens.rs:121:9
|
||||
|
|
||||
LL | (unit!() - One)
|
||||
| ^ ^
|
||||
|
@ -352,7 +352,7 @@ LL + unit!() - One
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around block return value
|
||||
--> $DIR/lint-unnecessary-parens.rs:124:9
|
||||
--> $DIR/lint-unnecessary-parens.rs:123:9
|
||||
|
|
||||
LL | (unit![] - One)
|
||||
| ^ ^
|
||||
|
@ -364,7 +364,7 @@ LL + unit![] - One
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around block return value
|
||||
--> $DIR/lint-unnecessary-parens.rs:127:9
|
||||
--> $DIR/lint-unnecessary-parens.rs:126:9
|
||||
|
|
||||
LL | (unit! {} - One)
|
||||
| ^ ^
|
||||
|
@ -376,7 +376,7 @@ LL + unit! {} - One
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/lint-unnecessary-parens.rs:132:14
|
||||
--> $DIR/lint-unnecessary-parens.rs:131:14
|
||||
|
|
||||
LL | let _r = (&x);
|
||||
| ^ ^
|
||||
|
@ -388,7 +388,7 @@ LL + let _r = &x;
|
|||
|
|
||||
|
||||
error: unnecessary parentheses around assigned value
|
||||
--> $DIR/lint-unnecessary-parens.rs:133:14
|
||||
--> $DIR/lint-unnecessary-parens.rs:132:14
|
||||
|
|
||||
LL | let _r = (&mut x);
|
||||
| ^ ^
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Exercise the unused_mut attribute in some positive and negative cases
|
||||
|
||||
#![warn(unused_mut)]
|
||||
#![feature(async_closure, raw_ref_op)]
|
||||
#![feature(async_closure)]
|
||||
|
||||
async fn baz_async(
|
||||
mut a: i32,
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#![feature(let_chains)]
|
||||
#![feature(more_qualified_paths)]
|
||||
#![feature(never_patterns)]
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(trait_alias)]
|
||||
#![feature(try_blocks)]
|
||||
#![feature(type_ascription)]
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// check raw fat pointer ops in mir
|
||||
// FIXME: please improve this when we get monomorphization support
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
#![allow(ambiguous_wide_pointer_comparisons)]
|
||||
|
||||
use std::mem;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: method `foo` is never used
|
||||
--> $DIR/mir_raw_fat_ptr.rs:101:16
|
||||
--> $DIR/mir_raw_fat_ptr.rs:100:16
|
||||
|
|
||||
LL | trait Foo { fn foo(&self) -> usize; }
|
||||
| --- ^^^
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
#![feature(raw_ref_op)]
|
||||
//@ ignore-emscripten weird assertion?
|
||||
|
||||
#[repr(packed)]
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
// gate-test-raw_ref_op
|
||||
|
||||
macro_rules! is_expr {
|
||||
($e:expr) => {}
|
||||
}
|
||||
|
||||
is_expr!(&raw const a); //~ ERROR raw address of syntax is experimental
|
||||
is_expr!(&raw mut a); //~ ERROR raw address of syntax is experimental
|
||||
|
||||
#[cfg(FALSE)]
|
||||
fn cfgd_out() {
|
||||
let mut a = 0;
|
||||
&raw const a; //~ ERROR raw address of syntax is experimental
|
||||
&raw mut a; //~ ERROR raw address of syntax is experimental
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut y = 123;
|
||||
let x = &raw const y; //~ ERROR raw address of syntax is experimental
|
||||
let x = &raw mut y; //~ ERROR raw address of syntax is experimental
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
error[E0658]: raw address of syntax is experimental
|
||||
--> $DIR/feature-raw-ref-op.rs:13:5
|
||||
|
|
||||
LL | &raw const a;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information
|
||||
= help: add `#![feature(raw_ref_op)]` 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[E0658]: raw address of syntax is experimental
|
||||
--> $DIR/feature-raw-ref-op.rs:14:5
|
||||
|
|
||||
LL | &raw mut a;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information
|
||||
= help: add `#![feature(raw_ref_op)]` 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[E0658]: raw address of syntax is experimental
|
||||
--> $DIR/feature-raw-ref-op.rs:19:13
|
||||
|
|
||||
LL | let x = &raw const y;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information
|
||||
= help: add `#![feature(raw_ref_op)]` 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[E0658]: raw address of syntax is experimental
|
||||
--> $DIR/feature-raw-ref-op.rs:20:13
|
||||
|
|
||||
LL | let x = &raw mut y;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information
|
||||
= help: add `#![feature(raw_ref_op)]` 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[E0658]: raw address of syntax is experimental
|
||||
--> $DIR/feature-raw-ref-op.rs:7:10
|
||||
|
|
||||
LL | is_expr!(&raw const a);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information
|
||||
= help: add `#![feature(raw_ref_op)]` 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[E0658]: raw address of syntax is experimental
|
||||
--> $DIR/feature-raw-ref-op.rs:8:10
|
||||
|
|
||||
LL | is_expr!(&raw mut a);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information
|
||||
= help: add `#![feature(raw_ref_op)]` 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 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
|
@ -1,7 +1,5 @@
|
|||
//@ run-pass
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
fn main() {
|
||||
let mut x = 123;
|
||||
let c_p = &raw const x;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@ check-pass
|
||||
// Check that taking the address of a place that contains a dereference is
|
||||
// allowed.
|
||||
#![feature(raw_ref_op, type_ascription)]
|
||||
#![feature(type_ascription)]
|
||||
|
||||
const PAIR_REF: &(i32, i64) = &(1, 2);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Ensure that we don't allow taking the address of temporary values
|
||||
#![feature(raw_ref_op, type_ascription)]
|
||||
#![feature(type_ascription)]
|
||||
|
||||
const FOUR: u64 = 4;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
const USES_PTR: () = { let u = (); &raw const u; };
|
||||
static ALSO_USES_PTR: () = { let u = (); &raw const u; };
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
//@ error-pattern: Location is heap block of size 4
|
||||
//@ error-pattern: allocated by main thread
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(rustc_private)]
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//@ check-pass
|
||||
#![feature(raw_ref_op)]
|
||||
use std::ptr;
|
||||
|
||||
// see https://github.com/rust-lang/rust/issues/125833
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//@ check-pass
|
||||
#![feature(raw_ref_op)]
|
||||
use std::ptr;
|
||||
|
||||
// see https://github.com/rust-lang/rust/issues/125833
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#![feature(never_type)]
|
||||
#![feature(pattern_types)]
|
||||
#![feature(prelude_import)]
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(specialization)]
|
||||
#![feature(trace_macros)]
|
||||
#![feature(trait_alias)]
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#![feature(never_type)]
|
||||
#![feature(pattern_types)]
|
||||
#![feature(prelude_import)]
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(specialization)]
|
||||
#![feature(trace_macros)]
|
||||
#![feature(trait_alias)]
|
||||
|
|
Loading…
Reference in New Issue