"rustc_attrs",
"internal rustc attributes will never be stable",
cfg_fn!(rustc_attrs))),
- ("rustc_move_fragments", Normal, Gated(Stability::Unstable,
- "rustc_attrs",
- "the `#[rustc_move_fragments]` attribute \
- is just used for rustc unit tests \
- and will never be stable",
- cfg_fn!(rustc_attrs))),
("rustc_mir", Whitelisted, Gated(Stability::Unstable,
"rustc_attrs",
"the `#[rustc_mir]` attribute \
#[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
-#[rustc_move_fragments] //~ ERROR the `#[rustc_move_fragments]` attribute is just used for rustc unit tests and will never be stable
#[rustc_foo]
//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// These are all fairly trivial cases: unused variables or direct
-// drops of substructure.
-
-#![feature(rustc_attrs)]
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-#[rustc_move_fragments]
-pub fn test_noop() {
-}
-
-#[rustc_move_fragments]
-pub fn test_take(_x: D) {
- //~^ ERROR assigned_leaf_path: `$(local _x)`
-}
-
-pub struct Pair<X,Y> { x: X, y: Y }
-
-#[rustc_move_fragments]
-pub fn test_take_struct(_p: Pair<D, D>) {
- //~^ ERROR assigned_leaf_path: `$(local _p)`
-}
-
-#[rustc_move_fragments]
-pub fn test_drop_struct_part(p: Pair<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR moved_leaf_path: `$(local p).x`
- //~| ERROR unmoved_fragment: `$(local p).y`
- drop(p.x);
-}
-
-#[rustc_move_fragments]
-pub fn test_drop_tuple_part(p: (D, D)) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR moved_leaf_path: `$(local p).#0`
- //~| ERROR unmoved_fragment: `$(local p).#1`
- drop(p.0);
-}
-
-pub fn main() { }
+++ /dev/null
-// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// These are checking that enums are tracked; note that their output
-// paths include "downcasts" of the path to a particular enum.
-
-#![feature(rustc_attrs)]
-
-use self::Lonely::{Zero, One, Two};
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-pub enum Lonely<X,Y> { Zero, One(X), Two(X, Y) }
-
-#[rustc_move_fragments]
-pub fn test_match_partial(p: Lonely<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::Zero)`
- match p {
- Zero => {}
- _ => {}
- }
-}
-
-#[rustc_move_fragments]
-pub fn test_match_full(p: Lonely<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::Zero)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::One)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::Two)`
- match p {
- Zero => {}
- One(..) => {}
- Two(..) => {}
- }
-}
-
-#[rustc_move_fragments]
-pub fn test_match_bind_one(p: Lonely<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::Zero)`
- //~| ERROR parent_of_fragments: `($(local p) as Lonely::One)`
- //~| ERROR moved_leaf_path: `($(local p) as Lonely::One).#0`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::Two)`
- //~| ERROR assigned_leaf_path: `$(local data)`
- match p {
- Zero => {}
- One(data) => {}
- Two(..) => {}
- }
-}
-
-#[rustc_move_fragments]
-pub fn test_match_bind_many(p: Lonely<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::Zero)`
- //~| ERROR parent_of_fragments: `($(local p) as Lonely::One)`
- //~| ERROR moved_leaf_path: `($(local p) as Lonely::One).#0`
- //~| ERROR assigned_leaf_path: `$(local data)`
- //~| ERROR parent_of_fragments: `($(local p) as Lonely::Two)`
- //~| ERROR moved_leaf_path: `($(local p) as Lonely::Two).#0`
- //~| ERROR moved_leaf_path: `($(local p) as Lonely::Two).#1`
- //~| ERROR assigned_leaf_path: `$(local left)`
- //~| ERROR assigned_leaf_path: `$(local right)`
- match p {
- Zero => {}
- One(data) => {}
- Two(left, right) => {}
- }
-}
-
-pub fn main() { }
+++ /dev/null
-// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// This checks the handling of `_` within variants, especially when mixed
-// with bindings.
-
-#![feature(rustc_attrs)]
-
-use self::Lonely::{Zero, One, Two};
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-pub enum Lonely<X,Y> { Zero, One(X), Two(X, Y) }
-
-#[rustc_move_fragments]
-pub fn test_match_bind_and_underscore(p: Lonely<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::Zero)`
- //~| ERROR assigned_leaf_path: `($(local p) as Lonely::One)`
- //~| ERROR parent_of_fragments: `($(local p) as Lonely::Two)`
- //~| ERROR moved_leaf_path: `($(local p) as Lonely::Two).#0`
- //~| ERROR unmoved_fragment: `($(local p) as Lonely::Two).#1`
- //~| ERROR assigned_leaf_path: `$(local left)`
-
- match p {
- Zero => {}
-
- One(_) => {} // <-- does not fragment `($(local p) as One)` ...
-
- Two(left, _) => {} // <-- ... *does* fragment `($(local p) as Two)`.
- }
-}
-
-pub fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// This checks that a move of deep structure is properly tracked. (An
-// early draft of the code did not properly traverse up through all of
-// the parents of the leaf fragment.)
-
-#![feature(rustc_attrs)]
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-pub struct Pair<X,Y> { x: X, y: Y }
-
-#[rustc_move_fragments]
-pub fn test_move_substructure(pppp: Pair<Pair<Pair<Pair<D,D>, D>, D>, D>) {
- //~^ ERROR parent_of_fragments: `$(local pppp)`
- //~| ERROR parent_of_fragments: `$(local pppp).x`
- //~| ERROR parent_of_fragments: `$(local pppp).x.x`
- //~| ERROR unmoved_fragment: `$(local pppp).x.x.x`
- //~| ERROR moved_leaf_path: `$(local pppp).x.x.y`
- //~| ERROR unmoved_fragment: `$(local pppp).x.y`
- //~| ERROR unmoved_fragment: `$(local pppp).y`
- drop(pppp.x.x.y);
-}
-
-pub fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// This is the first test that checks moving into local variables.
-
-#![feature(rustc_attrs)]
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-pub struct Pair<X,Y> { x: X, y: Y }
-
-#[rustc_move_fragments]
-pub fn test_move_field_to_local(p: Pair<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR moved_leaf_path: `$(local p).x`
- //~| ERROR unmoved_fragment: `$(local p).y`
- //~| ERROR assigned_leaf_path: `$(local _x)`
- let _x = p.x;
-}
-
-#[rustc_move_fragments]
-pub fn test_move_field_to_local_to_local(p: Pair<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR moved_leaf_path: `$(local p).x`
- //~| ERROR unmoved_fragment: `$(local p).y`
- //~| ERROR assigned_leaf_path: `$(local _x)`
- //~| ERROR moved_leaf_path: `$(local _x)`
- //~| ERROR assigned_leaf_path: `$(local _y)`
- let _x = p.x;
- let _y = _x;
-}
-
-// In the following fn's `test_move_field_to_local_delayed` and
-// `test_uninitialized_local` , the instrumentation reports that `_x`
-// is moved. This is unlike `test_move_field_to_local`, where `_x` is
-// just reported as an assigned_leaf_path. Presumably because this is
-// how we represent that it did not have an initializing expression at
-// the binding site.
-
-#[rustc_move_fragments]
-pub fn test_uninitialized_local(_p: Pair<D, D>) {
- //~^ ERROR assigned_leaf_path: `$(local _p)`
- //~| ERROR moved_leaf_path: `$(local _x)`
- let _x: D;
-}
-
-#[rustc_move_fragments]
-pub fn test_move_field_to_local_delayed(p: Pair<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR moved_leaf_path: `$(local p).x`
- //~| ERROR unmoved_fragment: `$(local p).y`
- //~| ERROR assigned_leaf_path: `$(local _x)`
- //~| ERROR moved_leaf_path: `$(local _x)`
- let _x;
- _x = p.x;
-}
-
-#[rustc_move_fragments]
-pub fn test_move_field_mut_to_local(mut p: Pair<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local mut p)`
- //~| ERROR moved_leaf_path: `$(local mut p).x`
- //~| ERROR unmoved_fragment: `$(local mut p).y`
- //~| ERROR assigned_leaf_path: `$(local _x)`
- let _x = p.x;
-}
-
-#[rustc_move_fragments]
-pub fn test_move_field_to_local_to_local_mut(p: Pair<D, D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR moved_leaf_path: `$(local p).x`
- //~| ERROR unmoved_fragment: `$(local p).y`
- //~| ERROR assigned_leaf_path: `$(local mut _x)`
- //~| ERROR moved_leaf_path: `$(local mut _x)`
- //~| ERROR assigned_leaf_path: `$(local _y)`
- let mut _x = p.x;
- let _y = _x;
-}
-
-pub fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// Test that moving into a field (i.e. overwriting it) fragments the
-// receiver.
-
-#![feature(rustc_attrs)]
-
-use std::mem::drop;
-
-pub struct Pair<X,Y> { x: X, y: Y }
-
-#[rustc_move_fragments]
-pub fn test_overwrite_uninit_field<Z>(z: Z) {
- //~^ ERROR parent_of_fragments: `$(local mut p)`
- //~| ERROR assigned_leaf_path: `$(local z)`
- //~| ERROR moved_leaf_path: `$(local z)`
- //~| ERROR assigned_leaf_path: `$(local mut p).x`
- //~| ERROR unmoved_fragment: `$(local mut p).y`
-
- let mut p: Pair<Z,Z>;
- p.x = z;
-}
-
-#[rustc_move_fragments]
-pub fn test_overwrite_moved_field<Z>(mut p: Pair<Z,Z>, z: Z) {
- //~^ ERROR parent_of_fragments: `$(local mut p)`
- //~| ERROR assigned_leaf_path: `$(local z)`
- //~| ERROR moved_leaf_path: `$(local z)`
- //~| ERROR assigned_leaf_path: `$(local mut p).y`
- //~| ERROR unmoved_fragment: `$(local mut p).x`
-
- drop(p);
- p.y = z;
-}
-
-#[rustc_move_fragments]
-pub fn test_overwrite_same_field<Z>(mut p: Pair<Z,Z>) {
- //~^ ERROR parent_of_fragments: `$(local mut p)`
- //~| ERROR moved_leaf_path: `$(local mut p).x`
- //~| ERROR assigned_leaf_path: `$(local mut p).x`
- //~| ERROR unmoved_fragment: `$(local mut p).y`
-
- p.x = p.x;
-}
-
-pub fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// Test that moving a Box<T> fragments its containing structure, for
-// both moving out of the structure (i.e. reading `*p.x`) and writing
-// into the container (i.e. writing `*p.x`).
-
-#![feature(rustc_attrs)]
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-pub struct Pair<X,Y> { x: X, y: Y }
-
-#[rustc_move_fragments]
-pub fn test_deref_box_field(p: Pair<Box<D>, Box<D>>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR parent_of_fragments: `$(local p).x`
- //~| ERROR moved_leaf_path: `$(local p).x.*`
- //~| ERROR unmoved_fragment: `$(local p).y`
- //~| ERROR assigned_leaf_path: `$(local i)`
- let i : D = *p.x;
-}
-
-#[rustc_move_fragments]
-pub fn test_overwrite_deref_box_field(mut p: Pair<Box<D>, Box<D>>) {
- //~^ ERROR parent_of_fragments: `$(local mut p)`
- //~| ERROR parent_of_fragments: `$(local mut p).x`
- //~| ERROR assigned_leaf_path: `$(local mut p).x.*`
- //~| ERROR unmoved_fragment: `$(local mut p).y`
- *p.x = D { d: 3 };
-}
-
-pub fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we correctly compute the move fragments for a fn.
-//
-// Note that the code below is not actually incorrect; the
-// `rustc_move_fragments` attribute is a hack that uses the error
-// reporting mechanisms as a channel for communicating from the
-// internals of the compiler.
-
-// Test that assigning into a `&T` within structured container does
-// *not* fragment its containing structure.
-//
-// Compare against the `Box<T>` handling in move-fragments-7.rs. Note
-// also that in this case we cannot do a move out of `&T`, so we only
-// test writing `*p.x` here.
-
-#![feature(rustc_attrs)]
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-pub struct Pair<X,Y> { x: X, y: Y }
-
-#[rustc_move_fragments]
-pub fn test_overwrite_deref_ampersand_field<'a>(p: Pair<&'a mut D, &'a D>) {
- //~^ ERROR parent_of_fragments: `$(local p)`
- //~| ERROR parent_of_fragments: `$(local p).x`
- //~| ERROR assigned_leaf_path: `$(local p).x.*`
- //~| ERROR unmoved_fragment: `$(local p).y`
- *p.x = D { d: 3 };
-}
-
-pub fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test moving array structures, e.g. `[T; 3]` as well as moving
-// elements in and out of such arrays.
-//
-// Note also that the `test_move_array_then_overwrite` tests represent
-// cases that we probably should make illegal.
-
-#![feature(rustc_attrs)]
-
-pub struct D { d: isize }
-impl Drop for D { fn drop(&mut self) { } }
-
-#[rustc_move_fragments]
-pub fn test_move_array_via_return(a: [D; 3]) -> [D; 3] {
- //~^ ERROR assigned_leaf_path: `$(local a)`
- //~| ERROR moved_leaf_path: `$(local a)`
- return a;
-}
-
-#[rustc_move_fragments]
-pub fn test_move_array_into_recv(a: [D; 3], recv: &mut [D; 3]) {
- //~^ ERROR parent_of_fragments: `$(local recv)`
- //~| ERROR assigned_leaf_path: `$(local a)`
- //~| ERROR moved_leaf_path: `$(local a)`
- //~| ERROR assigned_leaf_path: `$(local recv).*`
- *recv = a;
-}
-
-#[rustc_move_fragments]
-pub fn test_overwrite_array_elem(mut a: [D; 3], i: usize, d: D) {
- //~^ ERROR parent_of_fragments: `$(local mut a)`
- //~| ERROR assigned_leaf_path: `$(local i)`
- //~| ERROR assigned_leaf_path: `$(local d)`
- //~| ERROR moved_leaf_path: `$(local d)`
- //~| ERROR assigned_leaf_path: `$(local mut a).[]`
- //~| ERROR unmoved_fragment: `$(allbutone $(local mut a).[])`
- a[i] = d;
-}
-
-pub fn main() { }