Run rustfmt on tests/run-make/.

With the exception of `tests/run-make/translation/test.rs`, which has a
syntax error.

The expected output in `rustdoc-error-lines/rmake.rs`'s required slight
tweaking.

The two `reproducible-build.rs` files need `// ignore-tidy-linelength`
because rustfmt produces lines longer than 100 chars, which tidy doesn't
like, yuk.
This commit is contained in:
Nicholas Nethercote 2024-05-29 15:01:33 +10:00
parent 70bc0c5b20
commit 3079bd96b9
136 changed files with 421 additions and 370 deletions

View File

@ -20,7 +20,7 @@ ignore = [
"/tests/incremental/",
"/tests/mir-opt/",
"/tests/pretty/",
"/tests/run-make/",
"/tests/run-make/translation/test.rs", # Contains syntax errors.
"/tests/run-make-fulldeps/",
"/tests/run-pass-valgrind/",
"/tests/rustdoc/",

View File

@ -2,7 +2,7 @@
#![crate_type = "dylib"]
#[cfg(x)]
pub fn foo(x: u32) { }
pub fn foo(x: u32) {}
#[cfg(y)]
pub fn foo(x: i32) { }
pub fn foo(x: i32) {}

View File

@ -2,4 +2,4 @@
#[derive(Copy, Clone)]
pub struct Foo;
pub fn main() { }
pub fn main() {}

View File

@ -2,4 +2,6 @@
extern crate bar;
pub fn main() { bar::baz() }
pub fn main() {
bar::baz()
}

View File

@ -1,5 +1,5 @@
#![feature(no_core, intrinsics, lang_items)]
#![crate_type="rlib"]
#![crate_type = "rlib"]
#![no_core]
extern "rust-intrinsic" {

View File

@ -1,2 +1 @@
fn main() {
}
fn main() {}

View File

@ -1,8 +1,8 @@
#![crate_type="lib"]
#![crate_type = "lib"]
pub struct Foo(());
impl Foo {
pub fn new() -> Foo {
Foo(())
}
pub fn new() -> Foo {
Foo(())
}
}

View File

@ -1,7 +1,7 @@
#![crate_type="lib"]
#![crate_type = "lib"]
extern crate foo;
use foo::Foo;
pub fn crash() -> Box<Foo> {
Box::new(Foo::new())
Box::new(Foo::new())
}

View File

@ -1,16 +1,16 @@
#![crate_type = "staticlib"]
#![feature(c_variadic)]
use std::ffi::{c_char, c_double, c_int, c_long, c_longlong};
use std::ffi::VaList;
use std::ffi::{CString, CStr};
use std::ffi::{c_char, c_double, c_int, c_long, c_longlong};
use std::ffi::{CStr, CString};
macro_rules! continue_if {
($cond:expr) => {
if !($cond) {
return 0xff;
}
}
};
}
unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool {
@ -59,13 +59,11 @@ unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool {
continue_if!(ap.arg::<c_int>() == 16);
continue_if!(ap.arg::<c_char>() == 'A' as c_char);
continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!"));
ap.with_copy(|mut ap| {
if compare_c_str(ap.arg::<*const c_char>(), "Correct") {
0
} else {
0xff
}
})
ap.with_copy(
|mut ap| {
if compare_c_str(ap.arg::<*const c_char>(), "Correct") { 0 } else { 0xff }
},
)
}
#[no_mangle]

View File

@ -1,3 +1,3 @@
#![crate_type = "lib"]
extern crate b;
extern crate a;
extern crate b;

View File

@ -3,41 +3,20 @@
use run_make_support::{bin_name, rust_lib_name, rustc};
fn compare_stdout<S: AsRef<str>>(output: Output, expected: S) {
assert_eq!(
String::from_utf8(output.stdout).unwrap().trim(),
expected.as_ref()
);
assert_eq!(String::from_utf8(output.stdout).unwrap().trim(), expected.as_ref());
}
fn main() {
compare_stdout(rustc().print("crate-name").input("crate.rs").run(), "foo");
compare_stdout(rustc().print("file-names").input("crate.rs").run(), bin_name("foo"));
compare_stdout(
rustc().print("file-names").input("crate.rs").run(),
rustc().print("file-names").crate_type("lib").arg("--test").input("crate.rs").run(),
bin_name("foo"),
);
compare_stdout(
rustc()
.print("file-names")
.crate_type("lib")
.arg("--test")
.input("crate.rs")
.run(),
bin_name("foo"),
);
compare_stdout(
rustc()
.print("file-names")
.arg("--test")
.input("lib.rs")
.run(),
rustc().print("file-names").arg("--test").input("lib.rs").run(),
bin_name("mylib"),
);
compare_stdout(
rustc().print("file-names").input("lib.rs").run(),
rust_lib_name("mylib"),
);
compare_stdout(
rustc().print("file-names").input("rlib.rs").run(),
rust_lib_name("mylib"),
);
compare_stdout(rustc().print("file-names").input("lib.rs").run(), rust_lib_name("mylib"));
compare_stdout(rustc().print("file-names").input("rlib.rs").run(), rust_lib_name("mylib"));
}

View File

@ -1,4 +1,4 @@
#![crate_type="staticlib"]
#![crate_type = "staticlib"]
#[no_mangle]
pub extern "C" fn rust_always_inlined() -> u32 {

View File

@ -1,4 +1,4 @@
#![crate_type="staticlib"]
#![crate_type = "staticlib"]
#[no_mangle]
pub extern "C" fn rust_always_inlined() -> u32 {

View File

@ -1,4 +1,4 @@
#![crate_type="staticlib"]
#![crate_type = "staticlib"]
extern crate upstream;

View File

@ -15,19 +15,33 @@ fn main() {
fn debug_assert_eq() {
let mut hit1 = false;
let mut hit2 = false;
debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 });
debug_assert_eq!(
{
hit1 = true;
1
},
{
hit2 = true;
2
}
);
assert!(!hit1);
assert!(!hit2);
}
fn debug_assert() {
let mut hit = false;
debug_assert!({ hit = true; false });
debug_assert!({
hit = true;
false
});
assert!(!hit);
}
fn overflow() {
fn add(a: u8, b: u8) -> u8 { a + b }
fn add(a: u8, b: u8) -> u8 {
a + b
}
add(200u8, 200u8);
}

View File

@ -1,4 +1,4 @@
#[path="foo foo.rs"]
#[path = "foo foo.rs"]
pub mod foo;
pub mod bar;

View File

@ -1,4 +1,4 @@
#![crate_name = "foo"]
pub mod foo;
pub mod bar;
pub mod foo;

View File

@ -1,8 +1,10 @@
extern crate foo;
extern crate bar;
extern crate foo;
pub struct Bar;
impl ::std::ops::Deref for Bar {
type Target = bar::S;
fn deref(&self) -> &Self::Target { unimplemented!() }
fn deref(&self) -> &Self::Target {
unimplemented!()
}
}

View File

@ -3,7 +3,9 @@
extern crate proc_macro;
#[proc_macro_derive(A)]
pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { ts }
pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream {
ts
}
#[derive(Debug)]
struct S;

View File

@ -1,4 +1,6 @@
#![crate_type = "dylib"]
extern crate m1;
pub fn m2() { m1::m1() }
pub fn m2() {
m1::m1()
}

View File

@ -1,4 +1,6 @@
#![crate_type = "dylib"]
extern crate m2;
pub fn m3() { m2::m2() }
pub fn m3() {
m2::m2()
}

View File

@ -1,3 +1,5 @@
extern crate m3;
fn main() { m3::m3() }
fn main() {
m3::m3()
}

View File

@ -6,16 +6,22 @@ fn main() {
type Key = u32;
const NUM_THREADS: usize = 2;
#[derive(Clone,Copy)]
#[derive(Clone, Copy)]
struct Stats<S> {
upsert: S,
delete: S,
insert: S,
update: S
update: S,
};
impl<S> Stats<S> where S: Copy {
fn dot<B, F, T>(self, s: Stats<T>, f: F) -> Stats<B> where F: Fn(S, T) -> B {
impl<S> Stats<S>
where
S: Copy,
{
fn dot<B, F, T>(self, s: Stats<T>, f: F) -> Stats<B>
where
F: Fn(S, T) -> B,
{
let Stats { upsert: u1, delete: d1, insert: i1, update: p1 } = self;
let Stats { upsert: u2, delete: d2, insert: i2, update: p2 } = s;
Stats { upsert: f(u1, u2), delete: f(d1, d2), insert: f(i1, i2), update: f(p1, p2) }
@ -38,9 +44,12 @@ fn make_threads() -> Vec<thread::JoinHandle<()>> {
make_threads();
{
let Stats { ref upsert, ref delete, ref insert, ref update } = stats.iter().fold(
Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y)));
println!("upserts: {}, deletes: {}, inserts: {}, updates: {}",
upsert, delete, insert, update);
let Stats { ref upsert, ref delete, ref insert, ref update } = stats
.iter()
.fold(Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y)));
println!(
"upserts: {}, deletes: {}, inserts: {}, updates: {}",
upsert, delete, insert, update
);
}
}

View File

@ -1,5 +1,4 @@
#[macro_use]
extern crate foo;
fn main() {
}
fn main() {}

View File

@ -3,4 +3,6 @@
static FOO: usize = 3;
pub fn token() -> &'static usize { &FOO }
pub fn token() -> &'static usize {
&FOO
}

View File

@ -5,5 +5,9 @@
static FOO: usize = 3;
pub fn token() -> &'static usize { &FOO }
pub fn a_token() -> &'static usize { a::token() }
pub fn token() -> &'static usize {
&FOO
}
pub fn a_token() -> &'static usize {
a::token()
}

View File

@ -5,5 +5,9 @@
static FOO: usize = 3;
pub fn token() -> &'static usize { &FOO }
pub fn a_token() -> &'static usize { a::token() }
pub fn token() -> &'static usize {
&FOO
}
pub fn a_token() -> &'static usize {
a::token()
}

View File

@ -1,9 +1,13 @@
#[cfg(before)] extern crate a;
#[cfg(before)]
extern crate a;
#[cfg(after)]
extern crate a;
extern crate b;
extern crate c;
#[cfg(after)] extern crate a;
fn t(a: &'static usize) -> usize { a as *const _ as usize }
fn t(a: &'static usize) -> usize {
a as *const _ as usize
}
fn main() {
assert_eq!(t(a::token()), t(b::a_token()));

View File

@ -1,6 +1,6 @@
// Issue #80127: Passing structs via FFI should work with explicit alignment.
use std::ffi::{CStr, c_char};
use std::ffi::{c_char, CStr};
use std::ptr::null_mut;
#[repr(C)]
@ -18,7 +18,7 @@ pub struct TwoU64s {
#[repr(C)]
pub struct WrappedU64s {
pub a: TwoU64s
pub a: TwoU64s,
}
#[repr(C)]

View File

@ -1,14 +1,19 @@
#![crate_type = "dylib"]
#![allow(dead_code)]
#[no_mangle] pub extern "C" fn fun1() {}
#[no_mangle] extern "C" fn fun2() {}
#[no_mangle]
pub extern "C" fn fun1() {}
#[no_mangle]
extern "C" fn fun2() {}
mod foo {
#[no_mangle] pub extern "C" fn fun3() {}
#[no_mangle]
pub extern "C" fn fun3() {}
}
pub mod bar {
#[no_mangle] pub extern "C" fn fun4() {}
#[no_mangle]
pub extern "C" fn fun4() {}
}
#[no_mangle] pub fn fun5() {}
#[no_mangle]
pub fn fun5() {}

View File

@ -90,8 +90,12 @@ fn byval_rect_floats(
fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect);
fn byval_rect_with_many_huge64(
a: Huge64, b: Huge64, c: Huge64,
d: Huge64, e: Huge64, f: Huge64,
a: Huge64,
b: Huge64,
c: Huge64,
d: Huge64,
e: Huge64,
f: Huge64,
g: Rect,
);

View File

@ -1,5 +1,5 @@
extern crate foo2; // foo2 first to exhibit the bug
extern crate foo1;
extern crate foo2; // foo2 first to exhibit the bug
fn main() {
/* ... */

View File

@ -1,7 +1,6 @@
#![crate_type = "bin"]
#![no_main]
#![no_std]
#![deny(unused_extern_crates)]
// `panic` provides a `panic_handler` so it shouldn't trip the `unused_extern_crates` lint

View File

@ -9,8 +9,4 @@ fn main() {
// Basically, avoid modifying this file, including adding or removing whitespace!
fn foo() {
assert_eq!(1, 1);
}

View File

@ -8,5 +8,5 @@ fn main() {
// a.rs, the body must end on a line number which does not exist in b.rs.
// Basically, avoid modifying this file, including adding or removing whitespace!
fn foo() {
assert_eq!(1, 1);////
assert_eq!(1, 1); ////
}

View File

@ -2,11 +2,9 @@
pub mod a {
#[inline(always)]
pub fn foo() {
}
pub fn foo() {}
pub fn bar() {
}
pub fn bar() {}
}
#[no_mangle]

View File

@ -1,5 +1,5 @@
extern crate foo;
extern crate bar;
extern crate foo;
fn main() {
bar::doit();

View File

@ -1,4 +1,4 @@
#![crate_type="lib"]
#![crate_type = "lib"]
use std::arch::asm;
#[deny(unreachable_code)]

View File

@ -1,5 +1,5 @@
#![feature(core_intrinsics)]
#![crate_type="lib"]
#![crate_type = "lib"]
use std::arch::asm;
use std::intrinsics;

View File

@ -1,5 +1,5 @@
trait Foo { }
trait Foo {}
trait Bar { }
trait Bar {}
impl<'a> Foo for Bar + 'a { }
impl<'a> Foo for Bar + 'a {}

View File

@ -1,4 +1,6 @@
fn identity(a: &u32) -> &u32 { a }
fn identity(a: &u32) -> &u32 {
a
}
fn print_foo(f: &fn(&u32) -> &u32, x: &u32) {
print!("{}", (*f)(x));

View File

@ -2,4 +2,6 @@
/// assert_eq!(foo::foo(), 1);
/// ```
#[cfg(feature = "bar")]
pub fn foo() -> i32 { 1 }
pub fn foo() -> i32 {
1
}

View File

@ -1,3 +1,3 @@
#![crate_type="rlib"]
#![crate_type = "rlib"]
pub fn something(){}
pub fn something() {}

View File

@ -1,4 +1,4 @@
#![feature(rustc_private)]
extern crate libc;
fn main(){}
fn main() {}

View File

@ -1,2 +1,3 @@
#![crate_type = "lib"]
#[macro_use] extern crate a;
#[macro_use]
extern crate a;

View File

@ -7,9 +7,7 @@ struct Foo {
impl Foo {
const fn new() -> Self {
Self {
array: [0x1122_3344_5566_7788; 10240]
}
Self { array: [0x1122_3344_5566_7788; 10240] }
}
}

View File

@ -2,8 +2,8 @@
#![feature(start)]
#![no_std]
extern crate alloc;
extern crate a;
extern crate alloc;
extern crate b;
use alloc::vec::Vec;

View File

@ -1 +1 @@
fn main() { }
fn main() {}

View File

@ -13,13 +13,13 @@
use std::env;
use std::fs::{self, File};
use std::io::{BufWriter, Write, Read};
use std::io::{BufWriter, Read, Write};
use std::path::PathBuf;
use std::process::Command;
fn main() {
if !cfg!(windows) {
return
return;
}
let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
@ -31,16 +31,16 @@ fn main() {
let file = file.to_str().unwrap();
fs::copy(&file[1..], &ok).unwrap();
}
None => { File::create(&not_ok).unwrap(); }
None => {
File::create(&not_ok).unwrap();
}
}
return
return;
}
let rustc = env::var_os("RUSTC").unwrap_or("rustc".into());
let me = env::current_exe().unwrap();
let bat = me.parent()
.unwrap()
.join("foo.bat");
let bat = me.parent().unwrap().join("foo.bat");
let bat_linker = format!("linker={}", bat.display());
for i in (1..).map(|i| i * 10) {
println!("attempt: {}", i);
@ -61,8 +61,10 @@ fn main() {
drop(fs::remove_file(&not_ok));
let status = Command::new(&rustc)
.arg(&file)
.arg("-C").arg(&bat_linker)
.arg("--out-dir").arg(&tmpdir)
.arg("-C")
.arg(&bat_linker)
.arg("--out-dir")
.arg(&tmpdir)
.env("YOU_ARE_A_LINKER", "1")
.env("MY_LINKER", &me)
.status()
@ -74,7 +76,7 @@ fn main() {
if !ok.exists() {
assert!(not_ok.exists());
continue
continue;
}
let mut contents = Vec::new();
@ -96,6 +98,6 @@ fn main() {
assert!(contents.windows(exp.len()).any(|w| w == &exp[..]));
}
break
break;
}
}

View File

@ -34,9 +34,7 @@ fn write_test_case(file: &Path, n: usize) -> HashSet<String> {
fn read_linker_args(path: &Path) -> String {
let contents = fs::read(path).unwrap();
if cfg!(target_env = "msvc") {
let mut i = contents.chunks(2).map(|c| {
c[0] as u16 | ((c[1] as u16) << 8)
});
let mut i = contents.chunks(2).map(|c| c[0] as u16 | ((c[1] as u16) << 8));
assert_eq!(i.next(), Some(0xfeff), "Expected UTF-16 BOM");
String::from_utf16(&i.collect::<Vec<u16>>()).unwrap()
} else {
@ -52,7 +50,7 @@ fn main() {
let file = file.to_str().expect("non-utf8 file argument");
fs::copy(&file[1..], &ok).unwrap();
}
return
return;
}
let rustc = env::var_os("RUSTC").unwrap_or("rustc".into());
@ -65,28 +63,35 @@ fn main() {
drop(fs::remove_file(&ok));
let output = Command::new(&rustc)
.arg(&file)
.arg("-C").arg(&me_as_linker)
.arg("--out-dir").arg(&tmpdir)
.arg("-C")
.arg(&me_as_linker)
.arg("--out-dir")
.arg(&tmpdir)
.env("YOU_ARE_A_LINKER", "1")
.output()
.unwrap();
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
panic!("status: {}\nstdout:\n{}\nstderr:\n{}",
output.status,
String::from_utf8_lossy(&output.stdout),
stderr.lines().map(|l| {
if l.len() > 200 {
format!("{}...\n", &l[..200])
} else {
format!("{}\n", l)
}
}).collect::<String>());
panic!(
"status: {}\nstdout:\n{}\nstderr:\n{}",
output.status,
String::from_utf8_lossy(&output.stdout),
stderr
.lines()
.map(|l| {
if l.len() > 200 {
format!("{}...\n", &l[..200])
} else {
format!("{}\n", l)
}
})
.collect::<String>()
);
}
if !ok.exists() {
continue
continue;
}
let linker_args = read_linker_args(&ok);
@ -101,6 +106,6 @@ fn main() {
linker_args,
);
break
break;
}
}

View File

@ -1,4 +1,4 @@
#![crate_name="crateA"]
#![crate_name = "crateA"]
// Base crate
pub fn func<T>() {}

View File

@ -1,4 +1,6 @@
#![crate_name="crateA"]
#![crate_name = "crateA"]
// Base crate
pub fn func<T>() { println!("hello"); }
pub fn func<T>() {
println!("hello");
}

View File

@ -1,4 +1,6 @@
#![crate_name="crateA"]
#![crate_name = "crateA"]
// Base crate
pub fn foo<T>() { println!("world!"); }
pub fn foo<T>() {
println!("world!");
}

View File

@ -3,4 +3,6 @@
static FOO: usize = 3;
pub fn foo() -> &'static usize { &FOO }
pub fn foo() -> &'static usize {
&FOO
}

View File

@ -3,4 +3,6 @@
use std::mem;
pub fn addr() -> usize { unsafe { mem::transmute(&both::foo) } }
pub fn addr() -> usize {
unsafe { mem::transmute(&both::foo) }
}

View File

@ -1,9 +1,8 @@
extern crate dylib;
extern crate both;
extern crate dylib;
use std::mem;
fn main() {
assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) },
dylib::addr());
assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) }, dylib::addr());
}

View File

@ -1,4 +1,6 @@
#![crate_type = "dylib"]
extern crate rlib;
pub fn dylib() { rlib::rlib() }
pub fn dylib() {
rlib::rlib()
}

View File

@ -1,9 +1,11 @@
use std::io::Write;
#[link(name = "c_static_lib_with_constructor",
kind = "static",
modifiers = "-bundle,+whole-archive")]
extern {}
#[link(
name = "c_static_lib_with_constructor",
kind = "static",
modifiers = "-bundle,+whole-archive"
)]
extern "C" {}
pub fn hello() {
print!("native_lib_in_src.");

View File

@ -2,7 +2,9 @@
struct Destroy;
impl Drop for Destroy {
fn drop(&mut self) { println!("drop"); }
fn drop(&mut self) {
println!("drop");
}
}
thread_local! {

View File

@ -4,7 +4,7 @@ pub enum TT {
BB,
}
#[repr(C,u8)]
#[repr(C, u8)]
pub enum T {
A(u64),
B,
@ -16,6 +16,6 @@ pub enum T {
}
fn main() {
assert_eq!(33, unsafe { tt_add(TT::AA(1,2), TT::AA(10,20)) });
assert_eq!(33, unsafe { tt_add(TT::AA(1, 2), TT::AA(10, 20)) });
assert_eq!(11, unsafe { t_add(T::A(1), T::A(10)) });
}

View File

@ -1,2 +1 @@
fn main() {
}
fn main() {}

View File

@ -1,5 +1,5 @@
#![crate_name="interesting"]
#![crate_type="rlib"]
#![crate_name = "interesting"]
#![crate_type = "rlib"]
extern crate opaque;
@ -22,7 +22,6 @@ pub fn function_called_42_times(c: char) {
// This branch is taken 12 times
opaque::f1();
} else {
if c == 'b' {
// This branch is taken 28 times
opaque::f2();

View File

@ -1,5 +1,5 @@
#![crate_name="opaque"]
#![crate_type="rlib"]
#![crate_name = "opaque"]
#![crate_type = "rlib"]
pub fn f1() {}
pub fn f2() {}

View File

@ -1,5 +1,5 @@
#![crate_name="interesting"]
#![crate_type="rlib"]
#![crate_name = "interesting"]
#![crate_type = "rlib"]
extern crate opaque;
@ -15,7 +15,6 @@ pub fn function_called_never() {
#[no_mangle]
pub fn call_a_bunch_of_functions(fns: &[fn()]) {
// Indirect call promotion transforms the below into something like
//
// for f in fns {
@ -33,13 +32,11 @@ pub fn call_a_bunch_of_functions(fns: &[fn()]) {
}
}
pub trait Foo {
fn foo(&self);
}
impl Foo for u32 {
#[no_mangle]
fn foo(&self) {
opaque::opaque_f2();
@ -48,7 +45,6 @@ fn foo(&self) {
#[no_mangle]
pub fn call_a_bunch_of_trait_methods(trait_objects: &[&dyn Foo]) {
// Same as above, just with vtables in between
for x in trait_objects {
x.foo();

View File

@ -2,9 +2,8 @@
fn main() {
// function pointer case
let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn())
.take(1000)
.collect();
let fns: Vec<_> =
std::iter::repeat(interesting::function_called_always as fn()).take(1000).collect();
interesting::call_a_bunch_of_functions(&fns[..]);
// Trait object case

View File

@ -1,5 +1,5 @@
#![crate_name="opaque"]
#![crate_type="rlib"]
#![crate_name = "opaque"]
#![crate_type = "rlib"]
#[no_mangle]
pub fn opaque_f1() {}

View File

@ -11,7 +11,7 @@ pub fn hot_function(c: u8) {
fn main() {
let arg = std::env::args().skip(1).next().unwrap();
for i in 0 .. 1000_000 {
for i in 0..1000_000 {
let some_value = arg.as_bytes()[i % arg.len()];
if some_value == b'!' {
// This branch is never taken at runtime

View File

@ -4,5 +4,7 @@
}
fn main() {
unsafe {foo();}
unsafe {
foo();
}
}

View File

@ -1,5 +1,5 @@
#[crate_type="lib"]
#[crate_type = "lib"]
pub fn
foo() -> i32
{ 45 }
pub fn foo() -> i32 {
45
}

View File

@ -40,19 +40,21 @@ fn main() {
/*contains*/ &["feature", "feature=\"\"", "feature=\"test\"", "feature=\"lol\""],
);
check(
/*args*/ &[
/*args*/
&[
r#"--check-cfg=cfg(feature, values(any()))"#,
r#"--check-cfg=cfg(feature, values("tmp"))"#
r#"--check-cfg=cfg(feature, values("tmp"))"#,
],
/*has_any*/ false,
/*has_any_any*/ false,
/*contains*/ &["unix", "miri", "feature=any()"],
);
check(
/*args*/ &[
/*args*/
&[
r#"--check-cfg=cfg(has_foo, has_bar)"#,
r#"--check-cfg=cfg(feature, values("tmp"))"#,
r#"--check-cfg=cfg(feature, values("tmp"))"#
r#"--check-cfg=cfg(feature, values("tmp"))"#,
],
/*has_any*/ false,
/*has_any_any*/ false,

View File

@ -1,2 +1,3 @@
#![crate_type = "lib"]
#[macro_use] extern crate a;
#[macro_use]
extern crate a;

View File

@ -1,3 +1,3 @@
#![crate_type = "staticlib"]
extern crate b;
extern crate a;
extern crate b;

View File

@ -1 +1 @@
fn main() { }
fn main() {}

View File

@ -2,7 +2,6 @@
fn main() {
raw_dylib_alt_calling_convention_test::library_function(
std::env::args().skip(1).next().map_or(
false,
|s| std::str::FromStr::from_str(&s).unwrap()));
std::env::args().skip(1).next().map_or(false, |s| std::str::FromStr::from_str(&s).unwrap()),
);
}

View File

@ -1,16 +1,16 @@
#[link(name = "extern_1.dll", kind = "raw-dylib", modifiers = "+verbatim")]
extern {
extern "C" {
fn extern_fn_1();
}
#[link(name = "extern_2", kind = "raw-dylib")]
extern {
extern "C" {
fn extern_fn_3();
}
pub fn library_function() {
#[link(name = "extern_1", kind = "raw-dylib")]
extern {
extern "C" {
fn extern_fn_2();
fn print_extern_variable();
static mut extern_variable: i32;

View File

@ -8,7 +8,7 @@
trait Sized {}
#[link(name = "extern_1", kind = "raw-dylib")]
extern {
extern "C" {
fn extern_fn();
}

View File

@ -1,5 +1,5 @@
#[link(name = "extern_1", kind = "raw-dylib")]
extern {
extern "C" {
fn extern_fn_1();
}

View File

@ -76,7 +76,7 @@
}
#[link(name = "extern", kind = "raw-dylib")]
extern {
extern "C" {
fn print_extern_variable_undecorated();
fn print_extern_variable_noprefix();
fn print_extern_variable_decorated();

View File

@ -2,7 +2,7 @@
extern crate raw_dylib_test_wrapper;
#[link(name = "extern_2", kind = "raw-dylib")]
extern {
extern "C" {
fn extern_fn_2();
}

View File

@ -1,5 +1,5 @@
#[link(name = "extern_1", kind = "raw-dylib")]
extern {
extern "C" {
fn extern_fn_1();
fn extern_fn_2();
}

View File

@ -1,5 +1,5 @@
#[link(name = "exporter", kind = "raw-dylib")]
extern {
extern "C" {
#[link_ordinal(13)]
fn imported_function();
#[link_ordinal(5)]

View File

@ -1,7 +1,7 @@
use std::env;
use std::path::Path;
use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;
fn main() {
let mut dst = env::current_exe().unwrap();
@ -19,7 +19,7 @@ fn main() {
if !path.is_file() {
out.push_str(&arg);
out.push_str("\n");
continue
continue;
}
let mut contents = Vec::new();

View File

@ -1,4 +1,4 @@
#![crate_type="lib"]
#![crate_type = "lib"]
pub static STATIC: i32 = 1234;
@ -18,7 +18,7 @@ fn drop(&mut self) {}
pub enum Enum {
Variant1,
Variant2(u32),
Variant3 { x: u32 }
Variant3 { x: u32 },
}
pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64);

View File

@ -18,6 +18,8 @@
// - Trait object shims
// - Fn Pointer shims
// ignore-tidy-linelength
#![allow(dead_code, warnings)]
extern crate reproducible_build_aux;
@ -40,7 +42,7 @@ fn drop(&mut self) {}
pub enum Enum {
Variant1,
Variant2(u32),
Variant3 { x: u32 }
Variant3 { x: u32 },
}
struct TupleStruct(i8, i16, i32, i64);
@ -67,19 +69,14 @@ fn main() {
generic_fn::<char, Struct<u32, u64>>();
generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>();
let dropped = Struct {
x: "",
y: 'a',
};
let dropped = Struct { x: "", y: 'a' };
let _ = Enum::Variant1;
let _ = Enum::Variant2(0);
let _ = Enum::Variant3 { x: 0 };
let _ = TupleStruct(1, 2, 3, 4);
let closure = |x| {
x + 1i32
};
let closure = |x| x + 1i32;
fn inner<F: Fn(i32) -> i32>(f: F) -> i32 {
f(STATIC)
@ -94,13 +91,13 @@ fn with_fn_once_adapter<F: FnOnce(i32)>(f: F) {
f(0);
}
with_fn_once_adapter(|_:i32| { });
with_fn_once_adapter(|_: i32| {});
reproducible_build_aux::regular_fn(STATIC);
reproducible_build_aux::generic_fn::<u32, char>();
reproducible_build_aux::generic_fn::<char, Struct<u32, u64>>();
reproducible_build_aux::generic_fn::<Struct<u64, u32>,
reproducible_build_aux::Struct<u32, u64>>();
reproducible_build_aux::generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>(
);
let _ = reproducible_build_aux::Enum::Variant1;
let _ = reproducible_build_aux::Enum::Variant2(0);

View File

@ -1,7 +1,7 @@
use std::env;
use std::path::Path;
use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;
fn main() {
let mut dst = env::current_exe().unwrap();
@ -19,7 +19,7 @@ fn main() {
if !path.is_file() {
out.push_str(&arg);
out.push_str("\n");
continue
continue;
}
let mut contents = Vec::new();

View File

@ -1,4 +1,4 @@
#![crate_type="lib"]
#![crate_type = "lib"]
pub static STATIC: i32 = 1234;
@ -18,7 +18,7 @@ fn drop(&mut self) {}
pub enum Enum {
Variant1,
Variant2(u32),
Variant3 { x: u32 }
Variant3 { x: u32 },
}
pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64);

View File

@ -18,6 +18,8 @@
// - Trait object shims
// - Fn Pointer shims
// ignore-tidy-linelength
#![allow(dead_code, warnings)]
extern crate reproducible_build_aux;
@ -40,7 +42,7 @@ fn drop(&mut self) {}
pub enum Enum {
Variant1,
Variant2(u32),
Variant3 { x: u32 }
Variant3 { x: u32 },
}
struct TupleStruct(i8, i16, i32, i64);
@ -67,19 +69,14 @@ fn main() {
generic_fn::<char, Struct<u32, u64>>();
generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>();
let dropped = Struct {
x: "",
y: 'a',
};
let dropped = Struct { x: "", y: 'a' };
let _ = Enum::Variant1;
let _ = Enum::Variant2(0);
let _ = Enum::Variant3 { x: 0 };
let _ = TupleStruct(1, 2, 3, 4);
let closure = |x| {
x + 1i32
};
let closure = |x| x + 1i32;
fn inner<F: Fn(i32) -> i32>(f: F) -> i32 {
f(STATIC)
@ -94,13 +91,13 @@ fn with_fn_once_adapter<F: FnOnce(i32)>(f: F) {
f(0);
}
with_fn_once_adapter(|_:i32| { });
with_fn_once_adapter(|_: i32| {});
reproducible_build_aux::regular_fn(STATIC);
reproducible_build_aux::generic_fn::<u32, char>();
reproducible_build_aux::generic_fn::<char, Struct<u32, u64>>();
reproducible_build_aux::generic_fn::<Struct<u64, u32>,
reproducible_build_aux::Struct<u32, u64>>();
reproducible_build_aux::generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>(
);
let _ = reproducible_build_aux::Enum::Variant1;
let _ = reproducible_build_aux::Enum::Variant2(0);

View File

@ -1 +1 @@
fn main() { }
fn main() {}

View File

@ -2,4 +2,6 @@
extern crate foo;
pub fn bar() { foo::foo() }
pub fn bar() {
foo::foo()
}

View File

@ -2,4 +2,6 @@
extern crate bar;
pub fn baz() { bar::bar() }
pub fn baz() {
bar::bar()
}

View File

@ -4,7 +4,7 @@ pub enum TT {
BB,
}
#[repr(C,u8)]
#[repr(C, u8)]
pub enum T {
A(u64),
B,

View File

@ -9,7 +9,7 @@ pub extern "C" fn tt_new(a: u64, b: u64) -> TT {
TT::AA(a, b)
}
#[repr(C,u8)]
#[repr(C, u8)]
pub enum T {
A(u64),
B,

View File

@ -1,4 +1,6 @@
#![crate_type = "rlib"]
extern crate m1;
pub fn m2() { m1::m1() }
pub fn m2() {
m1::m1()
}

View File

@ -1,4 +1,6 @@
#![crate_type = "rlib"]
extern crate m2;
pub fn m3() { m2::m2() }
pub fn m3() {
m2::m2()
}

View File

@ -1,3 +1,5 @@
extern crate m3;
fn main() { m3::m3() }
fn main() {
m3::m3()
}

View File

@ -6,9 +6,7 @@
/// #![feature(bool_to_option)]
/// let x: char = 1;
/// ```
pub fn foo() {
}
pub fn foo() {}
/// Add some text around the test...
///

View File

@ -11,10 +11,10 @@ fn main() {
let should_contain = &[
"input.rs - foo (line 5)",
"input.rs:7:15",
"input.rs - bar (line 15)",
"input.rs:17:15",
"input.rs - bar (line 24)",
"input.rs:26:15",
"input.rs - bar (line 13)",
"input.rs:15:15",
"input.rs - bar (line 22)",
"input.rs:24:15",
];
for text in should_contain {
assert!(output.contains(text), "output doesn't contains {:?}", text);

View File

@ -1,5 +1,5 @@
pub use private::Quz;
pub use hidden::Bar;
pub use private::Quz;
mod private {
pub struct Quz;
@ -12,5 +12,5 @@ pub mod hidden {
#[macro_export]
macro_rules! foo {
() => {}
() => {};
}

View File

@ -1 +1,3 @@
pub const fn f() -> usize { 5 }
pub const fn f() -> usize {
5
}

View File

@ -8,20 +8,20 @@
#[an_attr_macro]
fn a() {
f(); // no
f(); // no
}
#[an_attr_macro(with_span)]
fn b() {
f(); // yes
f(); // yes
}
fn c() {
a_rules_macro!(f()); // yes
a_rules_macro!(f()); // yes
}
fn d() {
a_rules_macro!(()); // no
a_rules_macro!(()); // no
}
fn main(){}
fn main() {}

Some files were not shown because too many files have changed in this diff Show More