From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/auxiliary/augmented_assignments.rs | 8 ++ .../check_static_recursion_foreign_helper.rs | 11 ++ .../auxiliary/crate-method-reexport-grrrrrrr2.rs | 31 +++++ .../default-ty-param-cross-crate-crate.rs | 9 ++ tests/ui/auxiliary/edition-kw-macro-2015.rs | 26 ++++ tests/ui/auxiliary/edition-kw-macro-2018.rs | 26 ++++ tests/ui/auxiliary/fancy-panic.rs | 9 ++ tests/ui/auxiliary/hello_macro.rs | 21 ++++ tests/ui/auxiliary/impl_privacy_xc_1.rs | 9 ++ tests/ui/auxiliary/inner_static.rs | 51 ++++++++ tests/ui/auxiliary/issue-76387.rs | 29 +++++ tests/ui/auxiliary/kinds_in_metadata.rs | 8 ++ tests/ui/auxiliary/msvc-data-only-lib.rs | 5 + tests/ui/auxiliary/noexporttypelib.rs | 2 + tests/ui/auxiliary/orphan-check-diagnostics.rs | 1 + tests/ui/auxiliary/pub-and-stability.rs | 133 +++++++++++++++++++++ tests/ui/auxiliary/removing-extern-crate.rs | 1 + tests/ui/auxiliary/rustc-rust-log-aux.rs | 1 + tests/ui/auxiliary/svh-a-base.rs | 25 ++++ tests/ui/auxiliary/svh-b.rs | 13 ++ tests/ui/auxiliary/typeid-intrinsic-aux1.rs | 29 +++++ tests/ui/auxiliary/typeid-intrinsic-aux2.rs | 29 +++++ .../ui/auxiliary/using-target-feature-unstable.rs | 5 + tests/ui/auxiliary/xc-private-method-lib.rs | 33 +++++ 24 files changed, 515 insertions(+) create mode 100644 tests/ui/auxiliary/augmented_assignments.rs create mode 100644 tests/ui/auxiliary/check_static_recursion_foreign_helper.rs create mode 100644 tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs create mode 100644 tests/ui/auxiliary/default-ty-param-cross-crate-crate.rs create mode 100644 tests/ui/auxiliary/edition-kw-macro-2015.rs create mode 100644 tests/ui/auxiliary/edition-kw-macro-2018.rs create mode 100644 tests/ui/auxiliary/fancy-panic.rs create mode 100644 tests/ui/auxiliary/hello_macro.rs create mode 100644 tests/ui/auxiliary/impl_privacy_xc_1.rs create mode 100644 tests/ui/auxiliary/inner_static.rs create mode 100644 tests/ui/auxiliary/issue-76387.rs create mode 100644 tests/ui/auxiliary/kinds_in_metadata.rs create mode 100644 tests/ui/auxiliary/msvc-data-only-lib.rs create mode 100644 tests/ui/auxiliary/noexporttypelib.rs create mode 100644 tests/ui/auxiliary/orphan-check-diagnostics.rs create mode 100644 tests/ui/auxiliary/pub-and-stability.rs create mode 100644 tests/ui/auxiliary/removing-extern-crate.rs create mode 100644 tests/ui/auxiliary/rustc-rust-log-aux.rs create mode 100644 tests/ui/auxiliary/svh-a-base.rs create mode 100644 tests/ui/auxiliary/svh-b.rs create mode 100644 tests/ui/auxiliary/typeid-intrinsic-aux1.rs create mode 100644 tests/ui/auxiliary/typeid-intrinsic-aux2.rs create mode 100644 tests/ui/auxiliary/using-target-feature-unstable.rs create mode 100644 tests/ui/auxiliary/xc-private-method-lib.rs (limited to 'tests/ui/auxiliary') diff --git a/tests/ui/auxiliary/augmented_assignments.rs b/tests/ui/auxiliary/augmented_assignments.rs new file mode 100644 index 000000000..d0d3f5745 --- /dev/null +++ b/tests/ui/auxiliary/augmented_assignments.rs @@ -0,0 +1,8 @@ +use std::ops::AddAssign; + +pub struct Int(pub i32); + +impl AddAssign for Int { + fn add_assign(&mut self, _: i32) { + } +} diff --git a/tests/ui/auxiliary/check_static_recursion_foreign_helper.rs b/tests/ui/auxiliary/check_static_recursion_foreign_helper.rs new file mode 100644 index 000000000..5330b7a92 --- /dev/null +++ b/tests/ui/auxiliary/check_static_recursion_foreign_helper.rs @@ -0,0 +1,11 @@ +// Helper definition for test/run-pass/check-static-recursion-foreign.rs. + +#![feature(rustc_private)] + +#![crate_name = "check_static_recursion_foreign_helper"] +#![crate_type = "lib"] + +extern crate libc; + +#[no_mangle] +pub static test_static: libc::c_int = 0; diff --git a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs b/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs new file mode 100644 index 000000000..d08504005 --- /dev/null +++ b/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs @@ -0,0 +1,31 @@ +#![crate_name="crate_method_reexport_grrrrrrr2"] + +pub use name_pool::add; + +pub mod name_pool { + pub type name_pool = (); + + pub trait add { + fn add(&self, s: String); + } + + impl add for name_pool { + fn add(&self, _s: String) { + } + } +} + +pub mod rust { + pub use name_pool::add; + + pub type rt = Box<()>; + + pub trait cx { + fn cx(&self); + } + + impl cx for rt { + fn cx(&self) { + } + } +} diff --git a/tests/ui/auxiliary/default-ty-param-cross-crate-crate.rs b/tests/ui/auxiliary/default-ty-param-cross-crate-crate.rs new file mode 100644 index 000000000..d722b7876 --- /dev/null +++ b/tests/ui/auxiliary/default-ty-param-cross-crate-crate.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] +#![crate_name = "default_param_test"] +#![feature(default_type_parameter_fallback)] + +use std::marker::PhantomData; + +pub struct Foo(PhantomData<(A, B)>); + +pub fn bleh() -> Foo { Foo(PhantomData) } diff --git a/tests/ui/auxiliary/edition-kw-macro-2015.rs b/tests/ui/auxiliary/edition-kw-macro-2015.rs new file mode 100644 index 000000000..553ba6930 --- /dev/null +++ b/tests/ui/auxiliary/edition-kw-macro-2015.rs @@ -0,0 +1,26 @@ +// edition:2015 + +#[macro_export] +macro_rules! produces_async { + () => (pub fn async() {}) +} + +#[macro_export] +macro_rules! produces_async_raw { + () => (pub fn r#async() {}) +} + +#[macro_export] +macro_rules! consumes_async { + (async) => (1) +} + +#[macro_export] +macro_rules! consumes_async_raw { + (r#async) => (1) +} + +#[macro_export] +macro_rules! passes_ident { + ($i: ident) => ($i) +} diff --git a/tests/ui/auxiliary/edition-kw-macro-2018.rs b/tests/ui/auxiliary/edition-kw-macro-2018.rs new file mode 100644 index 000000000..f1f4ee280 --- /dev/null +++ b/tests/ui/auxiliary/edition-kw-macro-2018.rs @@ -0,0 +1,26 @@ +// edition:2018 + +#[macro_export] +macro_rules! produces_async { + () => (pub fn async() {}) +} + +#[macro_export] +macro_rules! produces_async_raw { + () => (pub fn r#async() {}) +} + +#[macro_export] +macro_rules! consumes_async { + (async) => (1) +} + +#[macro_export] +macro_rules! consumes_async_raw { + (r#async) => (1) +} + +#[macro_export] +macro_rules! passes_ident { + ($i: ident) => ($i) +} diff --git a/tests/ui/auxiliary/fancy-panic.rs b/tests/ui/auxiliary/fancy-panic.rs new file mode 100644 index 000000000..35be93b05 --- /dev/null +++ b/tests/ui/auxiliary/fancy-panic.rs @@ -0,0 +1,9 @@ +#[macro_export] +macro_rules! fancy_panic { + () => { + panic!("{}"); + }; + ($msg:expr) => { + panic!($msg) + }; +} diff --git a/tests/ui/auxiliary/hello_macro.rs b/tests/ui/auxiliary/hello_macro.rs new file mode 100644 index 000000000..a05b8d54d --- /dev/null +++ b/tests/ui/auxiliary/hello_macro.rs @@ -0,0 +1,21 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_quote)] + +extern crate proc_macro; + +use proc_macro::{TokenStream, quote}; + +// This macro is not very interesting, but it does contain delimited tokens with +// no content - `()` and `{}` - which has caused problems in the past. +// Also, it tests that we can escape `$` via `$$`. +#[proc_macro] +pub fn hello(_: TokenStream) -> TokenStream { + quote!({ + fn hello() {} + macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } } + m!(hello()); + }) +} diff --git a/tests/ui/auxiliary/impl_privacy_xc_1.rs b/tests/ui/auxiliary/impl_privacy_xc_1.rs new file mode 100644 index 000000000..367b8ec8b --- /dev/null +++ b/tests/ui/auxiliary/impl_privacy_xc_1.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] + +pub struct Fish { + pub x: isize +} + +impl Fish { + pub fn swim(&self) {} +} diff --git a/tests/ui/auxiliary/inner_static.rs b/tests/ui/auxiliary/inner_static.rs new file mode 100644 index 000000000..42dcd379d --- /dev/null +++ b/tests/ui/auxiliary/inner_static.rs @@ -0,0 +1,51 @@ +pub struct A { pub v: T } +pub struct B { pub v: T } + +pub mod test { + pub struct A { pub v: T } + + impl A { + pub fn foo(&self) -> isize { + static a: isize = 5; + return a + } + + pub fn bar(&self) -> isize { + static a: isize = 6; + return a; + } + } +} + +impl A { + pub fn foo(&self) -> isize { + static a: isize = 1; + return a + } + + pub fn bar(&self) -> isize { + static a: isize = 2; + return a; + } +} + +impl B { + pub fn foo(&self) -> isize { + static a: isize = 3; + return a + } + + pub fn bar(&self) -> isize { + static a: isize = 4; + return a; + } +} + +pub fn foo() -> isize { + let a = A { v: () }; + let b = B { v: () }; + let c = test::A { v: () }; + return a.foo() + a.bar() + + b.foo() + b.bar() + + c.foo() + c.bar(); +} diff --git a/tests/ui/auxiliary/issue-76387.rs b/tests/ui/auxiliary/issue-76387.rs new file mode 100644 index 000000000..873d2bedd --- /dev/null +++ b/tests/ui/auxiliary/issue-76387.rs @@ -0,0 +1,29 @@ +// compile-flags: -C opt-level=3 + +pub struct FatPtr { + ptr: *mut u8, + len: usize, +} + +impl FatPtr { + pub fn new(len: usize) -> FatPtr { + let ptr = Box::into_raw(vec![42u8; len].into_boxed_slice()) as *mut u8; + + FatPtr { ptr, len } + } +} + +impl std::ops::Deref for FatPtr { + type Target = [u8]; + + #[inline] + fn deref(&self) -> &[u8] { + unsafe { std::slice::from_raw_parts(self.ptr, self.len) } + } +} + +impl std::ops::Drop for FatPtr { + fn drop(&mut self) { + println!("Drop"); + } +} diff --git a/tests/ui/auxiliary/kinds_in_metadata.rs b/tests/ui/auxiliary/kinds_in_metadata.rs new file mode 100644 index 000000000..2a2106ff7 --- /dev/null +++ b/tests/ui/auxiliary/kinds_in_metadata.rs @@ -0,0 +1,8 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that metadata serialization works for the `Copy` kind. + +#![crate_type="lib"] + +pub fn f() {} diff --git a/tests/ui/auxiliary/msvc-data-only-lib.rs b/tests/ui/auxiliary/msvc-data-only-lib.rs new file mode 100644 index 000000000..ccaa6d8ed --- /dev/null +++ b/tests/ui/auxiliary/msvc-data-only-lib.rs @@ -0,0 +1,5 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub static FOO: i32 = 42; diff --git a/tests/ui/auxiliary/noexporttypelib.rs b/tests/ui/auxiliary/noexporttypelib.rs new file mode 100644 index 000000000..67889cc5f --- /dev/null +++ b/tests/ui/auxiliary/noexporttypelib.rs @@ -0,0 +1,2 @@ +pub type oint = Option; +pub fn foo() -> oint { Some(3) } diff --git a/tests/ui/auxiliary/orphan-check-diagnostics.rs b/tests/ui/auxiliary/orphan-check-diagnostics.rs new file mode 100644 index 000000000..6b2c42b69 --- /dev/null +++ b/tests/ui/auxiliary/orphan-check-diagnostics.rs @@ -0,0 +1 @@ +pub trait RemoteTrait { fn dummy(&self) { } } diff --git a/tests/ui/auxiliary/pub-and-stability.rs b/tests/ui/auxiliary/pub-and-stability.rs new file mode 100644 index 000000000..ee05a07db --- /dev/null +++ b/tests/ui/auxiliary/pub-and-stability.rs @@ -0,0 +1,133 @@ +// This crate attempts to enumerate the various scenarios for how a +// type can define fields and methods with various visibilities and +// stabilities. +// +// The basic stability pattern in this file has four cases: +// 1. no stability attribute at all +// 2. a stable attribute (feature "unit_test") +// 3. an unstable attribute that unit test declares (feature "unstable_declared") +// 4. an unstable attribute that unit test fails to declare (feature "unstable_undeclared") +// +// This file also covers four kinds of visibility: private, +// pub(module), pub(crate), and pub. +// +// However, since stability attributes can only be observed in +// cross-crate linkage scenarios, there is little reason to take the +// cross-product (4 stability cases * 4 visibility cases), because the +// first three visibility cases cannot be accessed outside this crate, +// and therefore stability is only relevant when the visibility is pub +// to the whole universe. +// +// (The only reason to do so would be if one were worried about the +// compiler having some subtle bug where adding a stability attribute +// introduces a privacy violation. As a way to provide evidence that +// this is not occurring, I have put stability attributes on some +// non-pub fields, marked with SILLY below) + +#![feature(staged_api)] + +#![stable(feature = "unit_test", since = "1.0.0")] + +#[stable(feature = "unit_test", since = "1.0.0")] +pub use m::{Record, Trait, Tuple}; + +mod m { + #[derive(Default)] + #[stable(feature = "unit_test", since = "1.0.0")] + pub struct Record { + #[stable(feature = "unit_test", since = "1.0.0")] + pub a_stable_pub: i32, + #[unstable(feature = "unstable_declared", issue = "38412")] + pub a_unstable_declared_pub: i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub a_unstable_undeclared_pub: i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY + pub(crate) b_crate: i32, + #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY + pub(in m) c_mod: i32, + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY + d_priv: i32 + } + + #[derive(Default)] + #[stable(feature = "unit_test", since = "1.0.0")] + pub struct Tuple( + #[stable(feature = "unit_test", since = "1.0.0")] + pub i32, + #[unstable(feature = "unstable_declared", issue = "38412")] + pub i32, + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub i32, + + pub(crate) i32, + pub(in m) i32, + i32); + + impl Record { + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn new() -> Self { Default::default() } + } + + impl Tuple { + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn new() -> Self { Default::default() } + } + + + #[stable(feature = "unit_test", since = "1.0.0")] + pub trait Trait { + #[stable(feature = "unit_test", since = "1.0.0")] + type Type; + #[stable(feature = "unit_test", since = "1.0.0")] + fn stable_trait_method(&self) -> Self::Type; + #[unstable(feature = "unstable_undeclared", issue = "38412")] + fn unstable_undeclared_trait_method(&self) -> Self::Type; + #[unstable(feature = "unstable_declared", issue = "38412")] + fn unstable_declared_trait_method(&self) -> Self::Type; + } + + #[stable(feature = "unit_test", since = "1.0.0")] + impl Trait for Record { + type Type = i32; + fn stable_trait_method(&self) -> i32 { self.d_priv } + fn unstable_undeclared_trait_method(&self) -> i32 { self.d_priv } + fn unstable_declared_trait_method(&self) -> i32 { self.d_priv } + } + + #[stable(feature = "unit_test", since = "1.0.0")] + impl Trait for Tuple { + type Type = i32; + fn stable_trait_method(&self) -> i32 { self.3 } + fn unstable_undeclared_trait_method(&self) -> i32 { self.3 } + fn unstable_declared_trait_method(&self) -> i32 { self.3 } + } + + impl Record { + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub fn unstable_undeclared(&self) -> i32 { self.d_priv } + #[unstable(feature = "unstable_declared", issue = "38412")] + pub fn unstable_declared(&self) -> i32 { self.d_priv } + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn stable(&self) -> i32 { self.d_priv } + + #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY + pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } + #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY + pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY + fn private(&self) -> i32 { self.d_priv } + } + + impl Tuple { + #[unstable(feature = "unstable_undeclared", issue = "38412")] + pub fn unstable_undeclared(&self) -> i32 { self.0 } + #[unstable(feature = "unstable_declared", issue = "38412")] + pub fn unstable_declared(&self) -> i32 { self.0 } + #[stable(feature = "unit_test", since = "1.0.0")] + pub fn stable(&self) -> i32 { self.0 } + + pub(crate) fn pub_crate(&self) -> i32 { self.0 } + pub(in m) fn pub_mod(&self) -> i32 { self.0 } + fn private(&self) -> i32 { self.0 } + } +} diff --git a/tests/ui/auxiliary/removing-extern-crate.rs b/tests/ui/auxiliary/removing-extern-crate.rs new file mode 100644 index 000000000..65e2cc340 --- /dev/null +++ b/tests/ui/auxiliary/removing-extern-crate.rs @@ -0,0 +1 @@ +// intentionally blank diff --git a/tests/ui/auxiliary/rustc-rust-log-aux.rs b/tests/ui/auxiliary/rustc-rust-log-aux.rs new file mode 100644 index 000000000..daa8e9f49 --- /dev/null +++ b/tests/ui/auxiliary/rustc-rust-log-aux.rs @@ -0,0 +1 @@ +// rustc-env:RUSTC_LOG=debug diff --git a/tests/ui/auxiliary/svh-a-base.rs b/tests/ui/auxiliary/svh-a-base.rs new file mode 100644 index 000000000..36b41fc81 --- /dev/null +++ b/tests/ui/auxiliary/svh-a-base.rs @@ -0,0 +1,25 @@ +//! The `svh-a-*.rs` files are all deviations from the base file +//! svh-a-base.rs with some difference (usually in `fn foo`) that +//! should not affect the strict version hash (SVH) computation +//! (#14132). + +#![crate_name = "a"] + +macro_rules! three { + () => { 3 } +} + +pub trait U {} +pub trait V {} +impl U for () {} +impl V for () {} + +static A_CONSTANT : isize = 2; + +pub fn foo(_: isize) -> isize { + 3 +} + +pub fn an_unused_name() -> isize { + 4 +} diff --git a/tests/ui/auxiliary/svh-b.rs b/tests/ui/auxiliary/svh-b.rs new file mode 100644 index 000000000..57029f708 --- /dev/null +++ b/tests/ui/auxiliary/svh-b.rs @@ -0,0 +1,13 @@ +//! This is a client of the `a` crate defined in `svn-a-base.rs`. The +//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use +//! it by swapping in a different object code library crate built from +//! some variant of `svn-a-base.rs`, and then we are checking if the +//! compiler properly ignores or accepts the change, based on whether +//! the change could affect the downstream crate content or not +//! (#14132). + +#![crate_name = "b"] + +extern crate a; + +pub fn foo() { assert_eq!(a::foo::<()>(0), 3); } diff --git a/tests/ui/auxiliary/typeid-intrinsic-aux1.rs b/tests/ui/auxiliary/typeid-intrinsic-aux1.rs new file mode 100644 index 000000000..281c07968 --- /dev/null +++ b/tests/ui/auxiliary/typeid-intrinsic-aux1.rs @@ -0,0 +1,29 @@ +use std::any::{Any, TypeId}; + +pub struct A; +pub struct B(Option); +pub struct C(Option); +pub struct D(Option<&'static str>); +pub struct E(Result<&'static str, isize>); + +pub type F = Option; +pub type G = usize; +pub type H = &'static str; +pub type I = Box; +pub type I32Iterator = Iterator; +pub type U32Iterator = Iterator; + +pub fn id_A() -> TypeId { TypeId::of::() } +pub fn id_B() -> TypeId { TypeId::of::() } +pub fn id_C() -> TypeId { TypeId::of::() } +pub fn id_D() -> TypeId { TypeId::of::() } +pub fn id_E() -> TypeId { TypeId::of::() } +pub fn id_F() -> TypeId { TypeId::of::() } +pub fn id_G() -> TypeId { TypeId::of::() } +pub fn id_H() -> TypeId { TypeId::of::() } +pub fn id_I() -> TypeId { TypeId::of::() } + +pub fn foo() -> TypeId { TypeId::of::() } + +pub fn id_i32_iterator() -> TypeId { TypeId::of::() } +pub fn id_u32_iterator() -> TypeId { TypeId::of::() } diff --git a/tests/ui/auxiliary/typeid-intrinsic-aux2.rs b/tests/ui/auxiliary/typeid-intrinsic-aux2.rs new file mode 100644 index 000000000..281c07968 --- /dev/null +++ b/tests/ui/auxiliary/typeid-intrinsic-aux2.rs @@ -0,0 +1,29 @@ +use std::any::{Any, TypeId}; + +pub struct A; +pub struct B(Option); +pub struct C(Option); +pub struct D(Option<&'static str>); +pub struct E(Result<&'static str, isize>); + +pub type F = Option; +pub type G = usize; +pub type H = &'static str; +pub type I = Box; +pub type I32Iterator = Iterator; +pub type U32Iterator = Iterator; + +pub fn id_A() -> TypeId { TypeId::of::() } +pub fn id_B() -> TypeId { TypeId::of::() } +pub fn id_C() -> TypeId { TypeId::of::() } +pub fn id_D() -> TypeId { TypeId::of::() } +pub fn id_E() -> TypeId { TypeId::of::() } +pub fn id_F() -> TypeId { TypeId::of::() } +pub fn id_G() -> TypeId { TypeId::of::() } +pub fn id_H() -> TypeId { TypeId::of::() } +pub fn id_I() -> TypeId { TypeId::of::() } + +pub fn foo() -> TypeId { TypeId::of::() } + +pub fn id_i32_iterator() -> TypeId { TypeId::of::() } +pub fn id_u32_iterator() -> TypeId { TypeId::of::() } diff --git a/tests/ui/auxiliary/using-target-feature-unstable.rs b/tests/ui/auxiliary/using-target-feature-unstable.rs new file mode 100644 index 000000000..268202893 --- /dev/null +++ b/tests/ui/auxiliary/using-target-feature-unstable.rs @@ -0,0 +1,5 @@ +#![feature(avx512_target_feature)] + +#[inline] +#[target_feature(enable = "avx512ifma")] +pub unsafe fn foo() {} diff --git a/tests/ui/auxiliary/xc-private-method-lib.rs b/tests/ui/auxiliary/xc-private-method-lib.rs new file mode 100644 index 000000000..4d5ec6de3 --- /dev/null +++ b/tests/ui/auxiliary/xc-private-method-lib.rs @@ -0,0 +1,33 @@ +#![crate_type="lib"] + +pub struct Struct { + pub x: isize +} + +impl Struct { + fn static_meth_struct() -> Struct { + Struct { x: 1 } + } + + fn meth_struct(&self) -> isize { + self.x + } +} + +pub enum Enum { + Variant1(isize), + Variant2(isize) +} + +impl Enum { + fn static_meth_enum() -> Enum { + Enum::Variant2(10) + } + + fn meth_enum(&self) -> isize { + match *self { + Enum::Variant1(x) | + Enum::Variant2(x) => x + } + } +} -- cgit v1.2.3