Auto merge of #47748 - alexcrichton:rollup, r=alexcrichton
Rollup of 19 pull requests - Successful merges: #47415, #47437, #47439, #47453, #47460, #47502, #47529, #47600, #47607, #47618, #47626, #47656, #47668, #47696, #47701, #47705, #47710, #47711, #47719 - Failed merges: #47455, #47521
This commit is contained in:
commit
bacb5c58df
118 changed files with 3683 additions and 2403 deletions
24
src/test/codegen/noreturnflag.rs
Normal file
24
src/test/codegen/noreturnflag.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
// min-llvm-version 4.0
|
||||
|
||||
// compile-flags: -g -C no-prepopulate-passes
|
||||
|
||||
// CHECK: {{.*}}DISubprogram{{.*}}name: "foo"{{.*}}DIFlagNoReturn
|
||||
|
||||
fn foo() -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
foo();
|
||||
}
|
||||
|
|
@ -22,9 +22,7 @@ pub struct i8x8(u64);
|
|||
|
||||
#[no_mangle]
|
||||
pub fn a(a: &mut i8x8, b: i8x8) -> i8x8 {
|
||||
// CHECK-LABEL: define x86_mmx @a(x86_mmx*{{.*}}, x86_mmx{{.*}})
|
||||
// CHECK: store x86_mmx %b, x86_mmx* %a
|
||||
// CHECK: ret x86_mmx %b
|
||||
// CHECK-LABEL: define void @a(x86_mmx*{{.*}}, x86_mmx*{{.*}}, x86_mmx*{{.*}})
|
||||
*a = b;
|
||||
return b
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,16 +17,22 @@ extern {
|
|||
fn main() {
|
||||
unsafe {
|
||||
printf(::std::ptr::null(), 0f32);
|
||||
//~^ ERROR can't pass `f32` to variadic function, cast to `c_double` [E0617]
|
||||
//~^ ERROR can't pass `f32` to variadic function
|
||||
//~| HELP cast the value to `c_double`
|
||||
printf(::std::ptr::null(), 0i8);
|
||||
//~^ ERROR can't pass `i8` to variadic function, cast to `c_int` [E0617]
|
||||
//~^ ERROR can't pass `i8` to variadic function
|
||||
//~| HELP cast the value to `c_int`
|
||||
printf(::std::ptr::null(), 0i16);
|
||||
//~^ ERROR can't pass `i16` to variadic function, cast to `c_int` [E0617]
|
||||
//~^ ERROR can't pass `i16` to variadic function
|
||||
//~| HELP cast the value to `c_int`
|
||||
printf(::std::ptr::null(), 0u8);
|
||||
//~^ ERROR can't pass `u8` to variadic function, cast to `c_uint` [E0617]
|
||||
//~^ ERROR can't pass `u8` to variadic function
|
||||
//~| HELP cast the value to `c_uint`
|
||||
printf(::std::ptr::null(), 0u16);
|
||||
//~^ ERROR can't pass `u16` to variadic function, cast to `c_uint` [E0617]
|
||||
//~^ ERROR can't pass `u16` to variadic function
|
||||
//~| HELP cast the value to `c_uint`
|
||||
printf(::std::ptr::null(), printf);
|
||||
//~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function, cast to `unsafe extern "C" fn(*const i8, ...)` [E0617]
|
||||
//~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
|
||||
//~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ struct Foo<T> {
|
|||
f: T
|
||||
}
|
||||
|
||||
#[rustc_if_this_changed]
|
||||
#[rustc_if_this_changed(Krate)]
|
||||
type TypeAlias<T> = Foo<T>;
|
||||
|
||||
#[rustc_then_this_would_need(ItemVariances)] //~ ERROR OK
|
||||
|
|
|
|||
27
src/test/compile-fail/empty-never-array.rs
Normal file
27
src/test/compile-fail/empty-never-array.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
enum Helper<T, U> {
|
||||
T(T, [!; 0]),
|
||||
#[allow(dead_code)]
|
||||
U(U),
|
||||
}
|
||||
|
||||
fn transmute<T, U>(t: T) -> U {
|
||||
let Helper::U(u) = Helper::T(t, []);
|
||||
//~^ ERROR refutable pattern in local binding: `T(_, _)` not covered
|
||||
u
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{:?}", transmute::<&str, (*const u8, u64)>("type safety"));
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
// Test that attempts to construct infinite types via impl trait fail
|
||||
// in a graceful way.
|
||||
//
|
||||
// Regression test for #38064.
|
||||
|
||||
// error-pattern:overflow evaluating the requirement `impl Quux`
|
||||
|
||||
#![feature(conservative_impl_trait)]
|
||||
|
||||
trait Quux {}
|
||||
|
||||
fn foo() -> impl Quux {
|
||||
struct Foo<T>(T);
|
||||
impl<T> Quux for Foo<T> {}
|
||||
Foo(bar())
|
||||
}
|
||||
|
||||
fn bar() -> impl Quux {
|
||||
struct Bar<T>(T);
|
||||
impl<T> Quux for Bar<T> {}
|
||||
Bar(foo())
|
||||
}
|
||||
|
||||
// effectively:
|
||||
// struct Foo(Bar);
|
||||
// struct Bar(Foo);
|
||||
// should produce an error about infinite size
|
||||
|
||||
fn main() { foo(); }
|
||||
|
|
@ -17,6 +17,7 @@ fn bar(_: *const u8) {}
|
|||
fn main() {
|
||||
unsafe {
|
||||
foo(0, bar);
|
||||
//~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function, cast to `fn(*const u8)`
|
||||
//~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function
|
||||
//~| HELP cast the value to `fn(*const u8)`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:needs-panic-runtime.rs
|
||||
// aux-build:runtime-depending-on-panic-runtime.rs
|
||||
// aux-build:depends.rs
|
||||
// error-pattern:cannot depend on a crate that needs a panic runtime
|
||||
|
||||
extern crate runtime_depending_on_panic_runtime;
|
||||
extern crate depends;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ all:
|
|||
$(RUSTC) -C extra-filename=foo dummy.rs 2>&1
|
||||
#Option taking no argument
|
||||
$(RUSTC) -C lto= dummy.rs 2>&1 | \
|
||||
$(CGREP) 'codegen option `lto` takes no value'
|
||||
$(CGREP) 'codegen option `lto` - one of `thin`, `fat`, or'
|
||||
$(RUSTC) -C lto=1 dummy.rs 2>&1 | \
|
||||
$(CGREP) 'codegen option `lto` takes no value'
|
||||
$(CGREP) 'codegen option `lto` - one of `thin`, `fat`, or'
|
||||
$(RUSTC) -C lto=foo dummy.rs 2>&1 | \
|
||||
$(CGREP) 'codegen option `lto` takes no value'
|
||||
$(CGREP) 'codegen option `lto` - one of `thin`, `fat`, or'
|
||||
$(RUSTC) -C lto dummy.rs
|
||||
|
||||
# Should not link dead code...
|
||||
|
|
|
|||
7
src/test/run-make/no-integrated-as/Makefile
Normal file
7
src/test/run-make/no-integrated-as/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-include ../tools.mk
|
||||
|
||||
all:
|
||||
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
|
||||
$(RUSTC) hello.rs -C no_integrated_as
|
||||
$(call RUN,hello)
|
||||
endif
|
||||
13
src/test/run-make/no-integrated-as/hello.rs
Normal file
13
src/test/run-make/no-integrated-as/hello.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// 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.
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
#![feature(attr_literals)]
|
||||
|
||||
#[repr(align(16))]
|
||||
pub struct A {
|
||||
y: i64,
|
||||
}
|
||||
pub struct A(i64);
|
||||
|
||||
pub extern "C" fn foo(x: A) {}
|
||||
|
||||
fn main() {}
|
||||
fn main() {
|
||||
foo(A(0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ pub fn main() { }
|
|||
#[cfg(target_arch = "mips64")]
|
||||
pub fn main() { }
|
||||
|
||||
#[cfg(target_arch = "powerpc")]
|
||||
pub fn main() { }
|
||||
|
||||
#[cfg(target_arch = "powerpc64")]
|
||||
pub fn main() { }
|
||||
|
||||
|
|
|
|||
17
src/test/run-pass/fat-lto.rs
Normal file
17
src/test/run-pass/fat-lto.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// 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.
|
||||
|
||||
// compile-flags: -Clto=fat
|
||||
// no-prefer-dynamic
|
||||
|
||||
fn main() {
|
||||
println!("hello!");
|
||||
}
|
||||
|
||||
|
|
@ -19,7 +19,8 @@ mod rusti {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "cloudabi",
|
||||
#[cfg(any(target_os = "android",
|
||||
target_os = "cloudabi",
|
||||
target_os = "dragonfly",
|
||||
target_os = "emscripten",
|
||||
target_os = "freebsd",
|
||||
|
|
@ -80,15 +81,3 @@ mod m {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod m {
|
||||
#[main]
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
assert_eq!(::rusti::pref_align_of::<u64>(), 8);
|
||||
assert_eq!(::rusti::min_align_of::<u64>(), 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
23
src/test/run-pass/issue-38763.rs
Normal file
23
src/test/run-pass/issue-38763.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// 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.
|
||||
|
||||
// ignore-emscripten
|
||||
|
||||
#![feature(i128_type)]
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Foo(i128);
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn foo(x: Foo) -> Foo { x }
|
||||
|
||||
fn main() {
|
||||
foo(Foo(1));
|
||||
}
|
||||
66
src/test/run-pass/issue-47364.rs
Normal file
66
src/test/run-pass/issue-47364.rs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
// compile-flags: -C codegen-units=8 -O
|
||||
|
||||
fn main() {
|
||||
nom_sql::selection(b"x ");
|
||||
}
|
||||
|
||||
pub enum Err<P>{
|
||||
Position(P),
|
||||
NodePosition(u32),
|
||||
}
|
||||
|
||||
pub enum IResult<I,O> {
|
||||
Done(I,O),
|
||||
Error(Err<I>),
|
||||
Incomplete(u32, u64)
|
||||
}
|
||||
|
||||
pub fn multispace<T: Copy>(input: T) -> ::IResult<i8, i8> {
|
||||
::IResult::Done(0, 0)
|
||||
}
|
||||
|
||||
mod nom_sql {
|
||||
fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option<String>> {
|
||||
let X = match ::multispace(i) {
|
||||
::IResult::Done(..) => ::IResult::Done(i, None::<String>),
|
||||
_ => ::IResult::Error(::Err::NodePosition(0)),
|
||||
};
|
||||
match X {
|
||||
::IResult::Done(_, _) => ::IResult::Done(i, None),
|
||||
_ => X
|
||||
}
|
||||
}
|
||||
|
||||
pub fn selection(i: &[u8]) {
|
||||
let Y = match {
|
||||
match {
|
||||
where_clause(i)
|
||||
} {
|
||||
::IResult::Done(_, o) => ::IResult::Done(i, Some(o)),
|
||||
::IResult::Error(_) => ::IResult::Done(i, None),
|
||||
_ => ::IResult::Incomplete(0, 0),
|
||||
}
|
||||
} {
|
||||
::IResult::Done(z, _) => ::IResult::Done(z, None::<String>),
|
||||
_ => return ()
|
||||
};
|
||||
match Y {
|
||||
::IResult::Done(x, _) => {
|
||||
let bytes = b"; ";
|
||||
let len = x.len();
|
||||
bytes[len];
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/test/run-pass/issue-47673.rs
Normal file
16
src/test/run-pass/issue-47673.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// 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.
|
||||
|
||||
#![feature(use_nested_groups)]
|
||||
#![allow(unused_import)]
|
||||
|
||||
use {{}, {}};
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -38,7 +38,8 @@ struct Outer {
|
|||
}
|
||||
|
||||
|
||||
#[cfg(any(target_os = "cloudabi",
|
||||
#[cfg(any(target_os = "android",
|
||||
target_os = "cloudabi",
|
||||
target_os = "dragonfly",
|
||||
target_os = "emscripten",
|
||||
target_os = "freebsd",
|
||||
|
|
@ -85,15 +86,6 @@ mod m {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod m {
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
pub mod m {
|
||||
pub fn align() -> usize { 8 }
|
||||
pub fn size() -> usize { 16 }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
let x = Outer {c8: 22, t: Inner {c64: 44}};
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ fn main() {
|
|||
unsafe {
|
||||
// Install signal hander that runs on alternate signal stack.
|
||||
let mut action: sigaction = std::mem::zeroed();
|
||||
action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
||||
action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _;
|
||||
action.sa_sigaction = signal_handler as sighandler_t;
|
||||
sigaction(SIGWINCH, &action, std::ptr::null_mut());
|
||||
|
||||
|
|
|
|||
188
src/test/run-pass/simd-target-feature-mixup.rs
Normal file
188
src/test/run-pass/simd-target-feature-mixup.rs
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
// 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.
|
||||
|
||||
// ignore-emscripten
|
||||
|
||||
#![feature(repr_simd, target_feature, cfg_target_feature)]
|
||||
|
||||
use std::process::{Command, ExitStatus};
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
if let Some(level) = env::args().nth(1) {
|
||||
return test::main(&level)
|
||||
}
|
||||
|
||||
let me = env::current_exe().unwrap();
|
||||
for level in ["sse", "avx", "avx512"].iter() {
|
||||
let status = Command::new(&me).arg(level).status().unwrap();
|
||||
if status.success() {
|
||||
println!("success with {}", level);
|
||||
continue
|
||||
}
|
||||
|
||||
// We don't actually know if our computer has the requisite target features
|
||||
// for the test below. Testing for that will get added to libstd later so
|
||||
// for now just asume sigill means this is a machine that can't run this test.
|
||||
if is_sigill(status) {
|
||||
println!("sigill with {}, assuming spurious", level);
|
||||
continue
|
||||
}
|
||||
panic!("invalid status at {}: {}", level, status);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn is_sigill(status: ExitStatus) -> bool {
|
||||
use std::os::unix::prelude::*;
|
||||
status.signal() == Some(4)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn is_sigill(status: ExitStatus) -> bool {
|
||||
status.code() == Some(0xc000001d)
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
#[allow(bad_style)]
|
||||
mod test {
|
||||
// An SSE type
|
||||
#[repr(simd)]
|
||||
#[derive(PartialEq, Debug, Clone, Copy)]
|
||||
struct __m128i(u64, u64);
|
||||
|
||||
// An AVX type
|
||||
#[repr(simd)]
|
||||
#[derive(PartialEq, Debug, Clone, Copy)]
|
||||
struct __m256i(u64, u64, u64, u64);
|
||||
|
||||
// An AVX-512 type
|
||||
#[repr(simd)]
|
||||
#[derive(PartialEq, Debug, Clone, Copy)]
|
||||
struct __m512i(u64, u64, u64, u64, u64, u64, u64, u64);
|
||||
|
||||
pub fn main(level: &str) {
|
||||
unsafe {
|
||||
main_normal(level);
|
||||
main_sse(level);
|
||||
if level == "sse" {
|
||||
return
|
||||
}
|
||||
main_avx(level);
|
||||
if level == "avx" {
|
||||
return
|
||||
}
|
||||
main_avx512(level);
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! mains {
|
||||
($(
|
||||
$(#[$attr:meta])*
|
||||
unsafe fn $main:ident(level: &str) {
|
||||
...
|
||||
}
|
||||
)*) => ($(
|
||||
$(#[$attr])*
|
||||
unsafe fn $main(level: &str) {
|
||||
let m128 = __m128i(1, 2);
|
||||
let m256 = __m256i(3, 4, 5, 6);
|
||||
let m512 = __m512i(7, 8, 9, 10, 11, 12, 13, 14);
|
||||
assert_eq!(id_sse_128(m128), m128);
|
||||
assert_eq!(id_sse_256(m256), m256);
|
||||
assert_eq!(id_sse_512(m512), m512);
|
||||
|
||||
if level == "sse" {
|
||||
return
|
||||
}
|
||||
assert_eq!(id_avx_128(m128), m128);
|
||||
assert_eq!(id_avx_256(m256), m256);
|
||||
assert_eq!(id_avx_512(m512), m512);
|
||||
|
||||
if level == "avx" {
|
||||
return
|
||||
}
|
||||
assert_eq!(id_avx512_128(m128), m128);
|
||||
assert_eq!(id_avx512_256(m256), m256);
|
||||
assert_eq!(id_avx512_512(m512), m512);
|
||||
}
|
||||
)*)
|
||||
}
|
||||
|
||||
mains! {
|
||||
unsafe fn main_normal(level: &str) { ... }
|
||||
#[target_feature(enable = "sse2")]
|
||||
unsafe fn main_sse(level: &str) { ... }
|
||||
#[target_feature(enable = "avx")]
|
||||
unsafe fn main_avx(level: &str) { ... }
|
||||
#[target_feature(enable = "avx512bw")]
|
||||
unsafe fn main_avx512(level: &str) { ... }
|
||||
}
|
||||
|
||||
|
||||
#[target_feature(enable = "sse2")]
|
||||
unsafe fn id_sse_128(a: __m128i) -> __m128i {
|
||||
assert_eq!(a, __m128i(1, 2));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "sse2")]
|
||||
unsafe fn id_sse_256(a: __m256i) -> __m256i {
|
||||
assert_eq!(a, __m256i(3, 4, 5, 6));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "sse2")]
|
||||
unsafe fn id_sse_512(a: __m512i) -> __m512i {
|
||||
assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "avx")]
|
||||
unsafe fn id_avx_128(a: __m128i) -> __m128i {
|
||||
assert_eq!(a, __m128i(1, 2));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "avx")]
|
||||
unsafe fn id_avx_256(a: __m256i) -> __m256i {
|
||||
assert_eq!(a, __m256i(3, 4, 5, 6));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "avx")]
|
||||
unsafe fn id_avx_512(a: __m512i) -> __m512i {
|
||||
assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "avx512bw")]
|
||||
unsafe fn id_avx512_128(a: __m128i) -> __m128i {
|
||||
assert_eq!(a, __m128i(1, 2));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "avx512bw")]
|
||||
unsafe fn id_avx512_256(a: __m256i) -> __m256i {
|
||||
assert_eq!(a, __m256i(3, 4, 5, 6));
|
||||
a.clone()
|
||||
}
|
||||
|
||||
#[target_feature(enable = "avx512bw")]
|
||||
unsafe fn id_avx512_512(a: __m512i) -> __m512i {
|
||||
assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14));
|
||||
a.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
mod test {
|
||||
pub fn main(level: &str) {}
|
||||
}
|
||||
17
src/test/run-pass/thinlto/all-crates.rs
Normal file
17
src/test/run-pass/thinlto/all-crates.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// 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.
|
||||
|
||||
// compile-flags: -Clto=thin
|
||||
// no-prefer-dynamic
|
||||
// min-llvm-version 4.0
|
||||
|
||||
fn main() {
|
||||
println!("hello!");
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z thinlto -C codegen-units=8 -O -C lto
|
||||
// compile-flags: -C codegen-units=8 -O -C lto=thin
|
||||
// aux-build:thin-lto-inlines-aux.rs
|
||||
// min-llvm-version 4.0
|
||||
// no-prefer-dynamic
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// aux-build:trait_inheritance_cross_trait_call_xc_aux.rs
|
||||
// aux-build:trait_xc_call_aux.rs
|
||||
|
||||
|
||||
extern crate trait_inheritance_cross_trait_call_xc_aux as aux;
|
||||
extern crate trait_xc_call_aux as aux;
|
||||
|
||||
use aux::Foo;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,5 @@ const EXPECTED = {
|
|||
{ 'path': 'std::char', 'name': 'from_u32' },
|
||||
{ 'path': 'std::str', 'name': 'from_utf8' },
|
||||
{ 'path': 'std::string::String', 'name': 'from_utf8' },
|
||||
{ 'path': 'std::i32', 'name': 'from_unsigned' },
|
||||
{ 'path': 'std::i128', 'name': 'from_unsigned' },
|
||||
],
|
||||
};
|
||||
|
|
|
|||
20
src/test/rustdoc/auxiliary/masked.rs
Normal file
20
src/test/rustdoc/auxiliary/masked.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// 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.
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MaskedStruct;
|
||||
|
||||
pub trait MaskedTrait {
|
||||
fn masked_method();
|
||||
}
|
||||
|
||||
impl MaskedTrait for String {
|
||||
fn masked_method() {}
|
||||
}
|
||||
|
|
@ -10,7 +10,13 @@
|
|||
|
||||
// @has intra_links/index.html
|
||||
// @has - '//a/@href' '../intra_links/struct.ThisType.html'
|
||||
// @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method'
|
||||
// @has - '//a/@href' '../intra_links/enum.ThisEnum.html'
|
||||
// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#ThisVariant.v'
|
||||
// @has - '//a/@href' '../intra_links/trait.ThisTrait.html'
|
||||
// @has - '//a/@href' '../intra_links/trait.ThisTrait.html#tymethod.this_associated_method'
|
||||
// @has - '//a/@href' '../intra_links/trait.ThisTrait.html#associatedtype.ThisAssociatedType'
|
||||
// @has - '//a/@href' '../intra_links/trait.ThisTrait.html#associatedconstant.THIS_ASSOCIATED_CONST'
|
||||
// @has - '//a/@href' '../intra_links/trait.ThisTrait.html'
|
||||
// @has - '//a/@href' '../intra_links/type.ThisAlias.html'
|
||||
// @has - '//a/@href' '../intra_links/union.ThisUnion.html'
|
||||
|
|
@ -23,8 +29,13 @@
|
|||
//! In this crate we would like to link to:
|
||||
//!
|
||||
//! * [`ThisType`](ThisType)
|
||||
//! * [`ThisType::this_method`](ThisType::this_method)
|
||||
//! * [`ThisEnum`](ThisEnum)
|
||||
//! * [`ThisEnum::ThisVariant`](ThisEnum::ThisVariant)
|
||||
//! * [`ThisTrait`](ThisTrait)
|
||||
//! * [`ThisTrait::this_associated_method`](ThisTrait::this_associated_method)
|
||||
//! * [`ThisTrait::ThisAssociatedType`](ThisTrait::ThisAssociatedType)
|
||||
//! * [`ThisTrait::THIS_ASSOCIATED_CONST`](ThisTrait::THIS_ASSOCIATED_CONST)
|
||||
//! * [`ThisAlias`](ThisAlias)
|
||||
//! * [`ThisUnion`](ThisUnion)
|
||||
//! * [`this_function`](this_function())
|
||||
|
|
@ -45,8 +56,16 @@ macro_rules! this_macro {
|
|||
}
|
||||
|
||||
pub struct ThisType;
|
||||
|
||||
impl ThisType {
|
||||
pub fn this_method() {}
|
||||
}
|
||||
pub enum ThisEnum { ThisVariant, }
|
||||
pub trait ThisTrait {}
|
||||
pub trait ThisTrait {
|
||||
type ThisAssociatedType;
|
||||
const THIS_ASSOCIATED_CONST: u8;
|
||||
fn this_associated_method();
|
||||
}
|
||||
pub type ThisAlias = Result<(), ()>;
|
||||
pub union ThisUnion { this_field: usize, }
|
||||
|
||||
|
|
|
|||
40
src/test/rustdoc/masked.rs
Normal file
40
src/test/rustdoc/masked.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// 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.
|
||||
|
||||
// aux-build:masked.rs
|
||||
|
||||
#![feature(doc_masked)]
|
||||
|
||||
#![crate_name = "foo"]
|
||||
|
||||
#[doc(masked)]
|
||||
extern crate masked;
|
||||
|
||||
// @!has 'search-index.js' 'masked_method'
|
||||
|
||||
// @!has 'foo/struct.String.html' 'MaskedTrait'
|
||||
// @!has 'foo/struct.String.html' 'masked_method'
|
||||
pub use std::string::String;
|
||||
|
||||
// @!has 'foo/trait.Clone.html' 'MaskedStruct'
|
||||
pub use std::clone::Clone;
|
||||
|
||||
// @!has 'foo/struct.MyStruct.html' 'MaskedTrait'
|
||||
// @!has 'foo/struct.MyStruct.html' 'masked_method'
|
||||
pub struct MyStruct;
|
||||
|
||||
impl masked::MaskedTrait for MyStruct {
|
||||
fn masked_method() {}
|
||||
}
|
||||
|
||||
// @!has 'foo/trait.MyTrait.html' 'MaskedStruct'
|
||||
pub trait MyTrait {}
|
||||
|
||||
impl MyTrait for masked::MaskedStruct {}
|
||||
35
src/test/ui/issue-47511.rs
Normal file
35
src/test/ui/issue-47511.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// 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.
|
||||
|
||||
// Regression test for #47511: anonymous lifetimes can appear
|
||||
// unconstrained in a return type, but only if they appear just once
|
||||
// in the input, as the input to a projection.
|
||||
|
||||
fn f(_: X) -> X {
|
||||
//~^ ERROR return type references an anonymous lifetime
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn g<'a>(_: X<'a>) -> X<'a> {
|
||||
//~^ ERROR return type references lifetime `'a`, which is not constrained
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
type X<'a> = <&'a () as Trait>::Value;
|
||||
|
||||
trait Trait {
|
||||
type Value;
|
||||
}
|
||||
|
||||
impl<'a> Trait for &'a () {
|
||||
type Value = ();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
16
src/test/ui/issue-47511.stderr
Normal file
16
src/test/ui/issue-47511.stderr
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
error[E0581]: return type references an anonymous lifetime which is not constrained by the fn input types
|
||||
--> $DIR/issue-47511.rs:15:15
|
||||
|
|
||||
15 | fn f(_: X) -> X {
|
||||
| ^
|
||||
|
|
||||
= note: lifetimes appearing in an associated type are not considered constrained
|
||||
|
||||
error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
|
||||
--> $DIR/issue-47511.rs:20:23
|
||||
|
|
||||
20 | fn g<'a>(_: X<'a>) -> X<'a> {
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
24
src/test/ui/issue-47706.rs
Normal file
24
src/test/ui/issue-47706.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// 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.
|
||||
|
||||
pub struct Foo {
|
||||
foo: Option<i32>,
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
pub fn new(foo: Option<i32>, _: ()) -> Foo {
|
||||
Foo { foo }
|
||||
}
|
||||
|
||||
pub fn map(self) -> Option<Foo> {
|
||||
self.foo.map(Foo::new)
|
||||
}
|
||||
//~^^ ERROR function is expected to take 1 argument, but it takes 2 arguments [E0593]
|
||||
}
|
||||
13
src/test/ui/issue-47706.stderr
Normal file
13
src/test/ui/issue-47706.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error[E0601]: main function not found
|
||||
|
||||
error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
|
||||
--> $DIR/issue-47706.rs:21:18
|
||||
|
|
||||
16 | pub fn new(foo: Option<i32>, _: ()) -> Foo {
|
||||
| ------------------------------------------ takes 2 arguments
|
||||
...
|
||||
21 | self.foo.map(Foo::new)
|
||||
| ^^^ expected function that takes 1 argument
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
@ -31,11 +31,11 @@ fn main() {
|
|||
//~| expected type `extern "C" fn(isize, u8, ...)`
|
||||
//~| found type `extern "C" fn(isize, u8) {bar}`
|
||||
|
||||
foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double`
|
||||
foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int`
|
||||
foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function, cast to `c_int`
|
||||
foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function, cast to `c_uint`
|
||||
foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function, cast to `c_int`
|
||||
foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function, cast to `c_uint`
|
||||
foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function
|
||||
foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function
|
||||
foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function
|
||||
foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function
|
||||
foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function
|
||||
foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,41 +34,41 @@ error[E0308]: mismatched types
|
|||
= note: expected type `extern "C" fn(isize, u8, ...)`
|
||||
found type `extern "C" fn(isize, u8) {bar}`
|
||||
|
||||
error[E0617]: can't pass `f32` to variadic function, cast to `c_double`
|
||||
error[E0617]: can't pass `f32` to variadic function
|
||||
--> $DIR/variadic-ffi-3.rs:34:19
|
||||
|
|
||||
34 | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double`
|
||||
| ^^^^
|
||||
34 | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function
|
||||
| ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
|
||||
|
||||
error[E0617]: can't pass `bool` to variadic function, cast to `c_int`
|
||||
error[E0617]: can't pass `bool` to variadic function
|
||||
--> $DIR/variadic-ffi-3.rs:35:19
|
||||
|
|
||||
35 | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int`
|
||||
| ^^^^
|
||||
35 | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function
|
||||
| ^^^^ help: cast the value to `c_int`: `true as c_int`
|
||||
|
||||
error[E0617]: can't pass `i8` to variadic function, cast to `c_int`
|
||||
error[E0617]: can't pass `i8` to variadic function
|
||||
--> $DIR/variadic-ffi-3.rs:36:19
|
||||
|
|
||||
36 | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function, cast to `c_int`
|
||||
| ^^^
|
||||
36 | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function
|
||||
| ^^^ help: cast the value to `c_int`: `1i8 as c_int`
|
||||
|
||||
error[E0617]: can't pass `u8` to variadic function, cast to `c_uint`
|
||||
error[E0617]: can't pass `u8` to variadic function
|
||||
--> $DIR/variadic-ffi-3.rs:37:19
|
||||
|
|
||||
37 | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function, cast to `c_uint`
|
||||
| ^^^
|
||||
37 | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function
|
||||
| ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
|
||||
|
||||
error[E0617]: can't pass `i16` to variadic function, cast to `c_int`
|
||||
error[E0617]: can't pass `i16` to variadic function
|
||||
--> $DIR/variadic-ffi-3.rs:38:19
|
||||
|
|
||||
38 | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function, cast to `c_int`
|
||||
| ^^^^
|
||||
38 | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function
|
||||
| ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
|
||||
|
||||
error[E0617]: can't pass `u16` to variadic function, cast to `c_uint`
|
||||
error[E0617]: can't pass `u16` to variadic function
|
||||
--> $DIR/variadic-ffi-3.rs:39:19
|
||||
|
|
||||
39 | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function, cast to `c_uint`
|
||||
| ^^^^
|
||||
39 | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function
|
||||
| ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue