2020-11-22 21:54:31 -06:00
|
|
|
#![feature(lang_items, no_core, auto_traits)]
|
2015-07-29 19:01:14 -05:00
|
|
|
#![no_core]
|
2014-07-23 13:56:36 -05:00
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
#[lang = "copy"]
|
|
|
|
trait Copy {}
|
librustc: Make `Copy` opt-in.
This change makes the compiler no longer infer whether types (structures
and enumerations) implement the `Copy` trait (and thus are implicitly
copyable). Rather, you must implement `Copy` yourself via `impl Copy for
MyType {}`.
A new warning has been added, `missing_copy_implementations`, to warn
you if a non-generic public type has been added that could have
implemented `Copy` but didn't.
For convenience, you may *temporarily* opt out of this behavior by using
`#![feature(opt_out_copy)]`. Note though that this feature gate will never be
accepted and will be removed by the time that 1.0 is released, so you should
transition your code away from using it.
This breaks code like:
#[deriving(Show)]
struct Point2D {
x: int,
y: int,
}
fn main() {
let mypoint = Point2D {
x: 1,
y: 1,
};
let otherpoint = mypoint;
println!("{}{}", mypoint, otherpoint);
}
Change this code to:
#[deriving(Show)]
struct Point2D {
x: int,
y: int,
}
impl Copy for Point2D {}
fn main() {
let mypoint = Point2D {
x: 1,
y: 1,
};
let otherpoint = mypoint;
println!("{}{}", mypoint, otherpoint);
}
This is the backwards-incompatible part of #13231.
Part of RFC #3.
[breaking-change]
2014-12-05 19:01:33 -06:00
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
#[lang = "sized"]
|
|
|
|
trait Sized {}
|
2014-07-23 13:56:36 -05:00
|
|
|
|
2017-04-18 03:02:21 -05:00
|
|
|
#[lang = "freeze"]
|
2017-12-03 06:56:53 -06:00
|
|
|
auto trait Freeze {}
|
2017-04-18 03:02:21 -05:00
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
#[lang = "start"]
|
2021-09-06 02:35:37 -05:00
|
|
|
fn start<T>(_main: *const u8, _argc: isize, _argv: *const *const u8) -> isize {
|
2020-09-01 16:12:52 -05:00
|
|
|
0
|
|
|
|
}
|
2014-07-23 13:56:36 -05:00
|
|
|
|
2020-09-01 16:12:52 -05:00
|
|
|
extern "C" {
|
2014-12-19 20:20:51 -06:00
|
|
|
fn _foo() -> [u8; 16];
|
2014-07-23 13:56:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn _main() {
|
|
|
|
let _a = unsafe { _foo() };
|
|
|
|
}
|