Skip to content

Commit 70a3be6

Browse files
authored
Rollup merge of rust-lang#57049 - cramertj:repr-packed, r=Centril
Stabilize #[repr(packed(N))] Fixes rust-lang#33158
2 parents 87a0202 + e5e19d9 commit 70a3be6

19 files changed

+18
-91
lines changed

src/doc/unstable-book/src/language-features/repr-packed.md

-8
This file was deleted.

src/libsyntax/feature_gate.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,6 @@ declare_features! (
397397
// Multiple patterns with `|` in `if let` and `while let`.
398398
(active, if_while_or_patterns, "1.26.0", Some(48215), None),
399399

400-
// Allows `#[repr(packed)]` attribute on structs.
401-
(active, repr_packed, "1.26.0", Some(33158), None),
402-
403400
// Allows macro invocations in `extern {}` blocks.
404401
(active, macros_in_extern, "1.27.0", Some(49476), None),
405402

@@ -695,6 +692,8 @@ declare_features! (
695692
(accepted, self_in_typedefs, "1.32.0", Some(49303), None),
696693
// `use path as _;` and `extern crate c as _;`
697694
(accepted, underscore_imports, "1.33.0", Some(48216), None),
695+
// Allows `#[repr(packed(N))]` attribute on structs.
696+
(accepted, repr_packed, "1.33.0", Some(33158), None),
698697
);
699698

700699
// If you change this, please modify `src/doc/unstable-book` as well. You must
@@ -1587,13 +1586,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
15871586
gate_feature_post!(&self, repr_simd, attr.span,
15881587
"SIMD types are experimental and possibly buggy");
15891588
}
1590-
if let Some((name, _)) = item.name_value_literal() {
1591-
if name == "packed" {
1592-
gate_feature_post!(&self, repr_packed, attr.span,
1593-
"the `#[repr(packed(n))]` attribute \
1594-
is experimental");
1595-
}
1596-
}
15971589
}
15981590
}
15991591
}

src/test/codegen/packed.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// min-llvm-version 7.0
1414

1515
#![crate_type = "lib"]
16-
#![feature(repr_packed)]
1716

1817
#[repr(packed)]
1918
pub struct Packed1 {

src/test/run-pass/issues/issue-48159.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(repr_packed)]
1312
#![allow(non_camel_case_types)]
1413

1514
use std::mem;

src/test/run-pass/packed/auxiliary/packed.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(repr_packed)]
12-
1311
#[repr(packed)]
1412
pub struct P1S5 {
1513
a: u8,

src/test/run-pass/packed/packed-struct-borrow-element.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#![allow(dead_code)]
1313
// ignore-emscripten weird assertion?
1414

15-
#![feature(repr_packed)]
16-
1715
#[repr(packed)]
1816
struct Foo1 {
1917
bar: u8,

src/test/run-pass/packed/packed-struct-generic-size.rs

-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010

1111
// run-pass
1212
#![allow(dead_code)]
13-
#![allow(stable_features)]
1413
#![allow(unused_comparisons)]
1514

16-
#![feature(repr_packed)]
17-
1815
use std::mem;
1916

2017
#[repr(packed)]

src/test/run-pass/packed/packed-struct-generic-size.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
warning: unnecessary path disambiguator
2-
--> $DIR/packed-struct-generic-size.rs:49:14
2+
--> $DIR/packed-struct-generic-size.rs:46:14
33
|
44
LL | check!(P1::<u8, u8>, 1, 3);
55
| ^^ try removing `::`
66

77
warning: unnecessary path disambiguator
8-
--> $DIR/packed-struct-generic-size.rs:50:14
8+
--> $DIR/packed-struct-generic-size.rs:47:14
99
|
1010
LL | check!(P1::<u64, u16>, 1, 11);
1111
| ^^ try removing `::`
1212

1313
warning: unnecessary path disambiguator
14-
--> $DIR/packed-struct-generic-size.rs:52:14
14+
--> $DIR/packed-struct-generic-size.rs:49:14
1515
|
1616
LL | check!(P2::<u8, u8>, 1, 3);
1717
| ^^ try removing `::`
1818

1919
warning: unnecessary path disambiguator
20-
--> $DIR/packed-struct-generic-size.rs:53:14
20+
--> $DIR/packed-struct-generic-size.rs:50:14
2121
|
2222
LL | check!(P2::<u64, u16>, 2, 12);
2323
| ^^ try removing `::`
2424

2525
warning: unnecessary path disambiguator
26-
--> $DIR/packed-struct-generic-size.rs:55:15
26+
--> $DIR/packed-struct-generic-size.rs:52:15
2727
|
2828
LL | check!(P4C::<u8, u8>, 1, 3);
2929
| ^^ try removing `::`
3030

3131
warning: unnecessary path disambiguator
32-
--> $DIR/packed-struct-generic-size.rs:56:15
32+
--> $DIR/packed-struct-generic-size.rs:53:15
3333
|
3434
LL | check!(P4C::<u16, u64>, 4, 12);
3535
| ^^ try removing `::`

src/test/run-pass/packed/packed-struct-match.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(repr_packed)]
1312

1413
#[repr(packed)]
1514
struct Foo1 {

src/test/run-pass/packed/packed-struct-size.rs

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
#![allow(non_camel_case_types)]
1414
#![allow(non_upper_case_globals)]
1515

16-
#![feature(repr_packed)]
17-
18-
1916
use std::mem;
2017

2118
#[repr(packed)]

src/test/run-pass/packed/packed-struct-vec.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(repr_packed)]
1312

1413
use std::fmt;
1514
use std::mem;

src/test/run-pass/packed/packed-tuple-struct-size.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#![allow(dead_code)]
1313
#![allow(non_camel_case_types)]
1414

15-
#![feature(repr_packed)]
16-
1715
use std::mem;
1816

1917
#[repr(packed)]

src/test/run-pass/structs-enums/align-struct.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// run-pass
1212
#![allow(dead_code)]
1313
#![feature(box_syntax)]
14-
#![feature(repr_packed)]
1514

1615
use std::mem;
1716

src/test/run-pass/union/union-packed.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#![allow(non_snake_case)]
1414

1515
#![feature(untagged_unions)]
16-
#![feature(repr_packed)]
1716

1817
use std::mem::{size_of, size_of_val, align_of, align_of_val};
1918

src/test/ui/conflicting-repr-hints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
#![allow(dead_code)]
12-
#![feature(repr_packed)]
1312

1413
#[repr(C)]
1514
enum A { A }

src/test/ui/conflicting-repr-hints.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
11
warning[E0566]: conflicting representation hints
2-
--> $DIR/conflicting-repr-hints.rs:20:8
2+
--> $DIR/conflicting-repr-hints.rs:19:8
33
|
44
LL | #[repr(C, u64)] //~ WARNING conflicting representation hints
55
| ^ ^^^
66

77
warning[E0566]: conflicting representation hints
8-
--> $DIR/conflicting-repr-hints.rs:23:8
8+
--> $DIR/conflicting-repr-hints.rs:22:8
99
|
1010
LL | #[repr(u32, u64)] //~ WARNING conflicting representation hints
1111
| ^^^ ^^^
1212

1313
error[E0587]: type has conflicting packed and align representation hints
14-
--> $DIR/conflicting-repr-hints.rs:30:1
14+
--> $DIR/conflicting-repr-hints.rs:29:1
1515
|
1616
LL | struct F(i32); //~ ERROR type has conflicting packed and align representation hints
1717
| ^^^^^^^^^^^^^^
1818

1919
error[E0587]: type has conflicting packed and align representation hints
20-
--> $DIR/conflicting-repr-hints.rs:34:1
20+
--> $DIR/conflicting-repr-hints.rs:33:1
2121
|
2222
LL | struct G(i32); //~ ERROR type has conflicting packed and align representation hints
2323
| ^^^^^^^^^^^^^^
2424

2525
error[E0587]: type has conflicting packed and align representation hints
26-
--> $DIR/conflicting-repr-hints.rs:38:1
26+
--> $DIR/conflicting-repr-hints.rs:37:1
2727
|
2828
LL | struct H(i32); //~ ERROR type has conflicting packed and align representation hints
2929
| ^^^^^^^^^^^^^^
3030

3131
error[E0634]: type has conflicting packed representation hints
32-
--> $DIR/conflicting-repr-hints.rs:41:1
32+
--> $DIR/conflicting-repr-hints.rs:40:1
3333
|
3434
LL | struct I(i32); //~ ERROR type has conflicting packed representation hints
3535
| ^^^^^^^^^^^^^^
3636

3737
error[E0634]: type has conflicting packed representation hints
38-
--> $DIR/conflicting-repr-hints.rs:45:1
38+
--> $DIR/conflicting-repr-hints.rs:44:1
3939
|
4040
LL | struct J(i32); //~ ERROR type has conflicting packed representation hints
4141
| ^^^^^^^^^^^^^^
4242

4343
error[E0587]: type has conflicting packed and align representation hints
44-
--> $DIR/conflicting-repr-hints.rs:51:1
44+
--> $DIR/conflicting-repr-hints.rs:50:1
4545
|
4646
LL | / union X { //~ ERROR type has conflicting packed and align representation hints
4747
LL | | i: i32
4848
LL | | }
4949
| |_^
5050

5151
error[E0587]: type has conflicting packed and align representation hints
52-
--> $DIR/conflicting-repr-hints.rs:57:1
52+
--> $DIR/conflicting-repr-hints.rs:56:1
5353
|
5454
LL | / union Y { //~ ERROR type has conflicting packed and align representation hints
5555
LL | | i: i32
5656
LL | | }
5757
| |_^
5858

5959
error[E0587]: type has conflicting packed and align representation hints
60-
--> $DIR/conflicting-repr-hints.rs:63:1
60+
--> $DIR/conflicting-repr-hints.rs:62:1
6161
|
6262
LL | / union Z { //~ ERROR type has conflicting packed and align representation hints
6363
LL | | i: i32

src/test/ui/feature-gates/feature-gate-repr_packed.rs

-18
This file was deleted.

src/test/ui/feature-gates/feature-gate-repr_packed.stderr

-19
This file was deleted.

src/test/ui/print_type_sizes/packed.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#![allow(dead_code)]
2323
#![feature(start)]
24-
#![feature(repr_packed)]
2524

2625
#[derive(Default)]
2726
#[repr(packed)]

0 commit comments

Comments
 (0)