mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
Stabilize #[repr(packed(N))]
This commit is contained in:
parent
01c6ea2f37
commit
87c8cdd8ef
@ -397,9 +397,6 @@ declare_features! (
|
||||
// Multiple patterns with `|` in `if let` and `while let`.
|
||||
(active, if_while_or_patterns, "1.26.0", Some(48215), None),
|
||||
|
||||
// Allows `#[repr(packed)]` attribute on structs.
|
||||
(active, repr_packed, "1.26.0", Some(33158), None),
|
||||
|
||||
// Allows macro invocations in `extern {}` blocks.
|
||||
(active, macros_in_extern, "1.27.0", Some(49476), None),
|
||||
|
||||
@ -695,6 +692,8 @@ declare_features! (
|
||||
(accepted, self_in_typedefs, "1.32.0", Some(49303), None),
|
||||
// `use path as _;` and `extern crate c as _;`
|
||||
(accepted, underscore_imports, "1.33.0", Some(48216), None),
|
||||
// Allows `#[repr(packed(N))]` attribute on structs.
|
||||
(accepted, repr_packed, "1.33.0", Some(33158), None),
|
||||
);
|
||||
|
||||
// If you change this, please modify `src/doc/unstable-book` as well. You must
|
||||
@ -1588,13 +1587,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
gate_feature_post!(&self, repr_simd, attr.span,
|
||||
"SIMD types are experimental and possibly buggy");
|
||||
}
|
||||
if let Some((name, _)) = item.name_value_literal() {
|
||||
if name == "packed" {
|
||||
gate_feature_post!(&self, repr_packed, attr.span,
|
||||
"the `#[repr(packed(n))]` attribute \
|
||||
is experimental");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
// min-llvm-version 7.0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(repr_packed)]
|
||||
|
||||
#[repr(packed)]
|
||||
pub struct Packed1 {
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
#![feature(repr_packed)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use std::mem;
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(repr_packed)]
|
||||
|
||||
#[repr(packed)]
|
||||
pub struct P1S5 {
|
||||
a: u8,
|
||||
|
@ -12,8 +12,6 @@
|
||||
#![allow(dead_code)]
|
||||
// ignore-emscripten weird assertion?
|
||||
|
||||
#![feature(repr_packed)]
|
||||
|
||||
#[repr(packed)]
|
||||
struct Foo1 {
|
||||
bar: u8,
|
||||
|
@ -10,11 +10,8 @@
|
||||
|
||||
// run-pass
|
||||
#![allow(dead_code)]
|
||||
#![allow(stable_features)]
|
||||
#![allow(unused_comparisons)]
|
||||
|
||||
#![feature(repr_packed)]
|
||||
|
||||
use std::mem;
|
||||
|
||||
#[repr(packed)]
|
||||
|
@ -1,35 +1,35 @@
|
||||
warning: unnecessary path disambiguator
|
||||
--> $DIR/packed-struct-generic-size.rs:49:14
|
||||
--> $DIR/packed-struct-generic-size.rs:46:14
|
||||
|
|
||||
LL | check!(P1::<u8, u8>, 1, 3);
|
||||
| ^^ try removing `::`
|
||||
|
||||
warning: unnecessary path disambiguator
|
||||
--> $DIR/packed-struct-generic-size.rs:50:14
|
||||
--> $DIR/packed-struct-generic-size.rs:47:14
|
||||
|
|
||||
LL | check!(P1::<u64, u16>, 1, 11);
|
||||
| ^^ try removing `::`
|
||||
|
||||
warning: unnecessary path disambiguator
|
||||
--> $DIR/packed-struct-generic-size.rs:52:14
|
||||
--> $DIR/packed-struct-generic-size.rs:49:14
|
||||
|
|
||||
LL | check!(P2::<u8, u8>, 1, 3);
|
||||
| ^^ try removing `::`
|
||||
|
||||
warning: unnecessary path disambiguator
|
||||
--> $DIR/packed-struct-generic-size.rs:53:14
|
||||
--> $DIR/packed-struct-generic-size.rs:50:14
|
||||
|
|
||||
LL | check!(P2::<u64, u16>, 2, 12);
|
||||
| ^^ try removing `::`
|
||||
|
||||
warning: unnecessary path disambiguator
|
||||
--> $DIR/packed-struct-generic-size.rs:55:15
|
||||
--> $DIR/packed-struct-generic-size.rs:52:15
|
||||
|
|
||||
LL | check!(P4C::<u8, u8>, 1, 3);
|
||||
| ^^ try removing `::`
|
||||
|
||||
warning: unnecessary path disambiguator
|
||||
--> $DIR/packed-struct-generic-size.rs:56:15
|
||||
--> $DIR/packed-struct-generic-size.rs:53:15
|
||||
|
|
||||
LL | check!(P4C::<u16, u64>, 4, 12);
|
||||
| ^^ try removing `::`
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
#![feature(repr_packed)]
|
||||
|
||||
#[repr(packed)]
|
||||
struct Foo1 {
|
||||
|
@ -13,9 +13,6 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
#![feature(repr_packed)]
|
||||
|
||||
|
||||
use std::mem;
|
||||
|
||||
#[repr(packed)]
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
#![feature(repr_packed)]
|
||||
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
|
@ -12,8 +12,6 @@
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#![feature(repr_packed)]
|
||||
|
||||
use std::mem;
|
||||
|
||||
#[repr(packed)]
|
||||
|
@ -11,7 +11,6 @@
|
||||
// run-pass
|
||||
#![allow(dead_code)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(repr_packed)]
|
||||
|
||||
use std::mem;
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
#![feature(untagged_unions)]
|
||||
#![feature(repr_packed)]
|
||||
|
||||
use std::mem::{size_of, size_of_val, align_of, align_of_val};
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(repr_packed)]
|
||||
|
||||
#[repr(C)]
|
||||
enum A { A }
|
||||
|
@ -1,47 +1,47 @@
|
||||
warning[E0566]: conflicting representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:20:8
|
||||
--> $DIR/conflicting-repr-hints.rs:19:8
|
||||
|
|
||||
LL | #[repr(C, u64)] //~ WARNING conflicting representation hints
|
||||
| ^ ^^^
|
||||
|
||||
warning[E0566]: conflicting representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:23:8
|
||||
--> $DIR/conflicting-repr-hints.rs:22:8
|
||||
|
|
||||
LL | #[repr(u32, u64)] //~ WARNING conflicting representation hints
|
||||
| ^^^ ^^^
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:30:1
|
||||
--> $DIR/conflicting-repr-hints.rs:29:1
|
||||
|
|
||||
LL | struct F(i32); //~ ERROR type has conflicting packed and align representation hints
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:34:1
|
||||
--> $DIR/conflicting-repr-hints.rs:33:1
|
||||
|
|
||||
LL | struct G(i32); //~ ERROR type has conflicting packed and align representation hints
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:38:1
|
||||
--> $DIR/conflicting-repr-hints.rs:37:1
|
||||
|
|
||||
LL | struct H(i32); //~ ERROR type has conflicting packed and align representation hints
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0634]: type has conflicting packed representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:41:1
|
||||
--> $DIR/conflicting-repr-hints.rs:40:1
|
||||
|
|
||||
LL | struct I(i32); //~ ERROR type has conflicting packed representation hints
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0634]: type has conflicting packed representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:45:1
|
||||
--> $DIR/conflicting-repr-hints.rs:44:1
|
||||
|
|
||||
LL | struct J(i32); //~ ERROR type has conflicting packed representation hints
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:51:1
|
||||
--> $DIR/conflicting-repr-hints.rs:50:1
|
||||
|
|
||||
LL | / union X { //~ ERROR type has conflicting packed and align representation hints
|
||||
LL | | i: i32
|
||||
@ -49,7 +49,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:57:1
|
||||
--> $DIR/conflicting-repr-hints.rs:56:1
|
||||
|
|
||||
LL | / union Y { //~ ERROR type has conflicting packed and align representation hints
|
||||
LL | | i: i32
|
||||
@ -57,7 +57,7 @@ LL | | }
|
||||
| |_^
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/conflicting-repr-hints.rs:63:1
|
||||
--> $DIR/conflicting-repr-hints.rs:62:1
|
||||
|
|
||||
LL | / union Z { //~ ERROR type has conflicting packed and align representation hints
|
||||
LL | | i: i32
|
||||
|
@ -1,18 +0,0 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental
|
||||
struct Foo(u64);
|
||||
|
||||
#[repr(C)]
|
||||
#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental
|
||||
struct Bar(u64);
|
||||
|
||||
fn main() {}
|
@ -1,19 +0,0 @@
|
||||
error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158)
|
||||
--> $DIR/feature-gate-repr_packed.rs:11:1
|
||||
|
|
||||
LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(repr_packed)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158)
|
||||
--> $DIR/feature-gate-repr_packed.rs:15:1
|
||||
|
|
||||
LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(repr_packed)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -21,7 +21,6 @@
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(start)]
|
||||
#![feature(repr_packed)]
|
||||
|
||||
#[derive(Default)]
|
||||
#[repr(packed)]
|
||||
|
Loading…
Reference in New Issue
Block a user