about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-02 08:34:27 +0000
committerbors <bors@rust-lang.org>2018-01-02 08:34:27 +0000
commit5873a74d8f8bceeb15a689a8fd6bd1f22c42b6ba (patch)
tree222d278a109ca698e963150c4342059072dc7c64 /src/test/compile-fail
parentb9cf26c38acf60fb1d7d88d914a22824b82ed829 (diff)
parent03936115eff4c1aa2be1ceeea87238ec7c822d90 (diff)
downloadrust-5873a74d8f8bceeb15a689a8fd6bd1f22c42b6ba.tar.gz
rust-5873a74d8f8bceeb15a689a8fd6bd1f22c42b6ba.zip
Auto merge of #47111 - rkruppe:repr-transparent, r=estebank
Check all repr hints together when checking for mis-applied attributes

Fixes #47094

Besides fixing that bug, this change has a user-visible effect on the spans in the "incompatible repr hints" warning and another error: they now point at `foo` and/or `bar` in `repr(foo, bar)` instead of the whole attribute. This is sometimes more precise (e.g., `#[repr(C, packed)]` on an enum points at the `packed`) but sometimes not. I moved a compile-fail test to a ui test to illustrate how it now looks in the common case of only one attribute.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/attr-usage-repr.rs45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/test/compile-fail/attr-usage-repr.rs b/src/test/compile-fail/attr-usage-repr.rs
deleted file mode 100644
index c0bfd3690c8..00000000000
--- a/src/test/compile-fail/attr-usage-repr.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 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.
-
-#![allow(dead_code)]
-#![feature(attr_literals)]
-#![feature(repr_simd)]
-
-#[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
-fn f() {}
-
-#[repr(C)]
-struct SExtern(f64, f64);
-
-#[repr(packed)]
-struct SPacked(f64, f64);
-
-#[repr(simd)]
-struct SSimd(f64, f64);
-
-#[repr(i8)] //~ ERROR: attribute should be applied to enum
-struct SInt(f64, f64);
-
-#[repr(C)]
-enum EExtern { A, B }
-
-#[repr(align(8))] //~ ERROR: attribute should be applied to struct
-enum EAlign { A, B }
-
-#[repr(packed)] //~ ERROR: attribute should be applied to struct
-enum EPacked { A, B }
-
-#[repr(simd)] //~ ERROR: attribute should be applied to struct
-enum ESimd { A, B }
-
-#[repr(i8)]
-enum EInt { A, B }
-
-fn main() {}