File: tied-features-no-implication.rs

package info (click to toggle)
rustc 1.88.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 934,128 kB
  • sloc: xml: 158,127; python: 36,062; javascript: 19,855; sh: 19,700; cpp: 18,947; ansic: 12,993; asm: 4,792; makefile: 690; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (29 lines) | stat: -rw-r--r-- 1,232 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//@ revisions: paca pacg
//@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//@[paca] compile-flags: -Ctarget-feature=+paca
//@[pacg] compile-flags: -Ctarget-feature=+pacg

#![feature(no_core, lang_items)]
#![no_core]

#[lang="sized"]
trait Sized {}

// Can't use `compile_error!` here without `core`/`std` but requiring these makes this test only
// work if you have libcore built in the sysroot for `aarch64-unknown-linux-gnu`. Can't run this
// test on any aarch64 platform because they all have different default available features - as
// written, this test depends on `aarch64-unknown-linux-gnu` having -paca,-pacg by default.
// Cause a multiple definition error instead.
fn foo() {}

// Enabling one of the tied features does not imply the other is enabled.
//
// With +paca, this multiple definition doesn't cause an error because +paca hasn't implied
// +pacg. With +pacg, the multiple definition error is emitted (and the tied feature error would
// be).

#[cfg(target_feature = "pacg")]
pub unsafe fn foo() {} //[pacg]~ ERROR the name `foo` is defined multiple times

//[paca]~? ERROR the target features paca, pacg must all be either enabled or disabled together