+// run-pass
+
#![allow(unused_imports)]
// ignore-cross-compile
+// run-pass
// Test that the Callbacks interface to the compiler works.
// ignore-cross-compile
+// run-pass
+
use std::env;
use std::fs;
use std::path::PathBuf;
+// run-pass
+
#![allow(dead_code)]
#![feature(rustc_private)]
#![no_std]
+// run-pass
+
#![allow(unused_imports)]
#![feature(box_syntax)]
+// run-pass
+
#![allow(unused_imports)]
// This briefly tests the capability of `Cell` and `RefCell` to implement the
// `Encodable` and `Decodable` traits via `#[derive(Encodable, Decodable)]`
+// run-pass
+
#![feature(rustc_private)]
extern crate serialize;
+// run-pass
+
#![allow(non_upper_case_globals)]
#![feature(rustc_private)]
extern crate serialize;
+// run-pass
+
#![allow(unknown_lints)]
// Check that an arena (TypedArena) can carry elements whose drop
// methods might access borrowed data, as long as the borrowed data
+// run-pass
// `#[derive(Trait)]` works for empty structs/variants with braces or parens.
#![feature(rustc_private)]
+// run-pass
+
#![allow(unused_imports)]
#![feature(rustc_private)]
+// run-pass
+
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(unused_imports)]
+// run-pass
// aux-build:issue-13560-1.rs
// aux-build:issue-13560-2.rs
// aux-build:issue-13560-3.rs
+// run-pass
+
#![allow(unused_mut)]
#![allow(unused_imports)]
#![feature(rustc_private)]
+// run-pass
+
#![allow(unused_variables)]
// no-prefer-dynamic
// ignore-cross-compile
+// run-pass
// aux-build:lint-for-crate.rs
// ignore-stage1
// compile-flags: -D crate-not-okay
+// run-pass
+
#![allow(unused_imports)]
#![allow(unused_must_use)]
// pretty-expanded FIXME #23616
+// run-pass
// aux-build:issue-16822.rs
extern crate issue_16822 as lib;
+// run-pass
// aux-build:issue-18502.rs
extern crate issue_18502 as fmt;
+// run-pass
// aux-build:issue-24106.rs
extern crate issue_24106;
+// run-pass
+
#![allow(dead_code)]
#![feature(rustc_private)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![feature(rustc_private)]
+// run-pass
// aux-build:issue-40001-plugin.rs
// ignore-stage1
+// run-pass
+
#![allow(dead_code)]
#![feature(rustc_private)]
+// run-pass
// Issue #4036: Test for an issue that arose around fixing up type inference
// byproducts in vtable records.
+// run-pass
// aux-build:linkage-visibility.rs
// ignore-android: FIXME(#10356)
// ignore-windows: std::dynamic_lib does not work on Windows well
+// run-pass
// aux-build:llvm-pass-plugin.rs
// ignore-stage1
+// run-pass
// aux-build:lto-syntax-extension-lib.rs
// aux-build:lto-syntax-extension-plugin.rs
// compile-flags:-C lto
+// run-pass
+
#![allow(plugin_as_library)]
#![allow(dead_code)]
#![allow(unused_variables)]
+// run-pass
// Testing that a libsyntax can parse modules with canonicalized base path
// ignore-cross-compile
+// run-pass
+
pub fn foo() -> isize { 10 }
+// run-pass
// This test case tests whether we can handle code bases that contain a high
// number of closures, something that needs special handling in the MingGW
// toolchain.
+// run-pass
+
#![feature(rustc_private)]
extern crate rustc_data_structures;
+// run-pass
// aux-build:outlive-expansion-phase.rs
// ignore-stage1
+// run-pass
// aux-build:plugin-args.rs
// ignore-stage1
+// run-pass
// aux-build:plugin-args.rs
// ignore-stage1
+// run-pass
// aux-build:plugin-args.rs
// ignore-stage1
+// run-pass
// ignore-cross-compile
// The general idea of this test is to enumerate all "interesting" expressions and check that
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_imports)]
+// run-pass
+
#![allow(unused_must_use)]
#![allow(unused_imports)]
// This test can't be a unit test in std,
+// run-pass
// aux-build:roman-numerals.rs
// ignore-stage1
+// run-pass
+
#![feature(rustc_private)]
#[allow(dead_code)]
+// run-pass
// ignore-cross-compile
use std::env;
+// run-pass
+
use std::env;
use std::fs::File;
use std::io::{Read, Write};
+// run-pass
// ignore-cross-compile
// ignore-stage1
+// run-pass
// Checks if the "sysv64" calling convention behaves the same as the
// "C" calling convention on platforms where both should be the same
+// run-pass
// Checks if the correct registers are being used to pass arguments
// when the sysv64 ABI is specified.
+// run-pass
+
#![allow(unused_must_use)]
// Since we mark some ABIs as "nounwind" to LLVM, we must make sure that
// we never unwind through them.
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
+
#![allow(stable_features)]
#![allow(unused_variables)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
+
#![allow(stable_features)]
#![feature(allocator_api, nonnull)]
+// run-pass
// pretty-expanded FIXME #23616
// ignore-wasm32-bare no libc to test ffi with
+// run-pass
+
struct X {
x: isize
}
+// run-pass
+
fn f() -> isize { { return 3; } }
pub fn main() { assert_eq!(f(), 3); }
+// run-pass
+
fn main() {
assert_eq!(3 as usize * 3, 9);
assert_eq!(3 as (usize) * 3, 9);
+// run-pass
// pretty-expanded FIXME #23616
// ignore-emscripten no asm
+// run-pass
+
#![feature(asm)]
#![allow(dead_code)]
+// run-pass
+
#![feature(asm)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+// run-pass
+
#![feature(asm)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+// run-pass
+
#![feature(asm)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+// run-pass
+
fn main() {
assert_eq!(1, 1,);
}
+// run-pass
+
fn main() {
assert!(r#"☃\backslash"#.contains("\\"));
}
+// run-pass
+
fn main() {
assert_ne!(1, 2,);
}
+// run-pass
// Issue 483 - Assignment expressions result in nil
fn test_assign() {
+// run-pass
+
fn that_odd_parse(c: bool, n: usize) -> u32 {
let x = 2;
let a = [1, 2, 3, 4];
+// run-pass
+
use std::mem::size_of;
// The main point of this test is to ensure that we can parse and resolve
+// run-pass
+
trait Foo: Iterator<Item = i32> {}
trait Bar: Foo {}
+// run-pass
+
#![allow(stable_features)]
#![feature(atomic_access)]
use std::sync::atomic::AtomicBool;
+// run-pass
+
#![feature(cfg_target_has_atomic)]
#![feature(integer_atomics)]
+// run-pass
+
#![allow(stable_features)]
#![feature(extended_compare_and_swap)]
+// run-pass
+
#![allow(unused_must_use)]
#![allow(deprecated)]
// ignore-cloudabi no process support
+// run-pass
+
#![feature(main)]
pub fn main() {
+// run-pass
// pretty-expanded FIXME #23616
#![feature(main)]
+// run-pass
+
#![allow(stable_features)]
#![feature(rust1)]
pub fn main() { }
+// run-pass
// pretty-expanded FIXME #23616
#![feature(start)]
+// run-pass
// pretty-expanded FIXME #23616
#![feature(main)]
+// run-pass
// aux-build:augmented_assignments.rs
extern crate augmented_assignments;
+// run-pass
+
use std::ops::AddAssign;
struct Int(i32);
+// run-pass
+
#![allow(unused_imports)]
#![deny(unused_assignments)]
+// run-pass
+
#![allow(dead_code)]
#[derive(Debug)]
struct Pair<T, U> { a: T, b: U }
+// run-pass
+
#![allow(path_statements)]
#![allow(dead_code)]
macro_rules! auto {
+// run-pass
+
fn f<T>(x: Vec<T>) -> T { return x.into_iter().next().unwrap(); }
fn g<F>(act: F) -> isize where F: FnOnce(Vec<isize>) -> isize { return act(vec![1, 2, 3]); }
+// run-pass
// ignore-test: not a test, used by backtrace-debuginfo.rs to test file!()
#[inline(never)]
+// run-pass
// We disable tail merging here because it can't preserve debuginfo and thus
// potentially breaks the backtraces. Also, subtle changes can decide whether
// tail merging succeeds, so the test might work today but fail tomorrow due to a
+// run-pass
// ignore-android FIXME #17520
// ignore-cloudabi spawning processes is not supported
// ignore-emscripten spawning processes is not supported
+// run-pass
+
use std::ops::FnMut;
fn call_f<F:FnMut()>(mut f: F) {
+// run-pass
+
pub fn main() {
let x: &'static str = "foo";
println!("{}", x);
+// run-pass
// Catch mistakes in the overflowing literals lint.
#![deny(overflowing_literals)]
+// run-pass
// Check that issue #954 stays fixed
+// run-pass
+
use std::sync::Arc;
fn dispose(_x: Arc<bool>) { }
+// run-pass
// Check that partially moved from function parameters are dropped after the
// named bindings that move from them.
+// run-pass
+
use std::ops::Mul;
#[derive(Copy, Clone)]
+// run-pass
+
#![allow(non_camel_case_types)]
// Binop corner cases
+// run-pass
+
#[cfg(any(target_pointer_width = "32"))]
fn target() {
assert_eq!(-1000isize as usize >> 3_usize, 536870787_usize);
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_imports)]
mod bar {
+// run-pass
// aux-build:blind-item-mixed-crate-use-item-foo.rs
// aux-build:blind-item-mixed-crate-use-item-foo2.rs
+// run-pass
// pretty-expanded FIXME #23616
mod m {
+// run-pass
+
#![allow(non_snake_case)]
fn asBlock<F>(f: F) -> usize where F: FnOnce() -> usize {
+// run-pass
// Check usage and precedence of block arguments in expressions:
pub fn main() {
let v = vec![-1.0f64, 0.0, 1.0, 2.0, 3.0];
+// run-pass
+
pub fn main() {
fn as_buf<T, F>(s: String, f: F) -> T where F: FnOnce(String) -> T { f(s) }
as_buf("foo".to_string(), |foo: String| -> () { println!("{}", foo) });
+// run-pass
+
#![allow(unused_must_use)]
#![allow(unused_parens)]
// This test has some extra semis in it that the pretty-printer won't
+// run-pass
+
fn force<F>(f: F) -> isize where F: FnOnce() -> isize { return f(); }
pub fn main() {
+// run-pass
+
fn iter_vec<T, F>(v: Vec<T> , mut f: F) where F: FnMut(&T) { for x in &v { f(x); } }
pub fn main() {
+// run-pass
+
fn iter_vec<T, F>(v: Vec<T>, mut f: F) where F: FnMut(&T) { for x in &v { f(x); } }
pub fn main() {
+// run-pass
+
pub fn main() {
if !false { assert!((true)); } else { assert!((false)); }
if !true { assert!((false)); } else { assert!((true)); }
+// run-pass
// Basic boolean tests
+// run-pass
+
trait Foo {
fn foo(self);
}
+// run-pass
// pretty-expanded FIXME #23616
fn main() {
+// run-pass
+
trait Speak : Sized {
fn say(&self, s:&str) -> String;
fn hi(&self) -> String { hello(self) }
+// run-pass
// pretty-expanded FIXME #23616
pub trait Foo<T> {
+// run-pass
+
#![allow(unused_variables)]
#![allow(unused_imports)]
// ignore-wasm32-bare compiled with panic=abort by default
+// run-pass
// Test that `Clone` is correctly implemented for builtin types.
// Also test that cloning an array or a tuple is done right, i.e.
// each component is cloned.
+// run-pass
// Tests "transitivity" of super-builtin-kinds on traits. Here, if
// we have a Foo, we know we have a Bar, and if we have a Bar, we
// know we have a Send. So if we have a Foo we should know we have
+// run-pass
// aux-build:trait_superkinds_in_metadata.rs
// Tests "capabilities" granted by traits with super-builtin-kinds,
+// run-pass
// Tests "capabilities" granted by traits that inherit from super-
// builtin-kinds, e.g., if a trait requires Send to implement, then
// at usage site of that trait, we know we have the Send capability.
+// run-pass
+
#![allow(unused_imports)]
// aux-build:trait_superkinds_in_metadata.rs
+// run-pass
+
#![allow(dead_code)]
// Tests that even when a type parameter doesn't implement a required
// super-builtin-kind of a trait, if the type parameter is never used,
+// run-pass
// Simple test case of implementing a trait with super-builtin-kinds.
// pretty-expanded FIXME #23616
+// run-pass
// Tests correct implementation of traits with super-builtin-kinds
// using a bounded type parameter.
+// run-pass
// pretty-expanded FIXME #23616
// ignore-wasm32-bare no libc to test ffi with
+// run-pass
// ignore-wasm32-bare no libc to test with
// ignore-sgx no libc
+// run-pass
// ignore-wasm32-bare no libc to test ffi with
#[link(name = "rust_test_helpers", kind = "static")]
+// run-pass
// pretty-expanded FIXME #23616
/* Any copyright is dedicated to the Public Domain.
+// run-pass
// pretty-expanded FIXME #23616
#![feature(box_syntax)]
+// run-pass
+
pub fn main() {
// Test that these type check correctly.
(&42u8 >> 4) as usize;
+// run-pass
+
pub fn main() {
let x: isize = 3;
println!("&x={:x}", (&x as *const isize as usize));
+// run-pass
// Check that you can cast between different pointers to trait objects
// whose vtable have the same kind (both lengths, or both trait pointers).
+// run-pass
+
#![allow(dead_code)]
use std::vec;
+// run-pass
// Check that we allow a cast to `_` so long as the target type can be
// inferred elsewhere.
+// run-pass
+
#![allow(unused_assignments)]
#![allow(unused_variables)]
+// run-pass
// ignore-wasm32-bare compiled with panic=abort by default
fn worker() -> ! {
+// run-pass
+
#![allow(dead_code)]
use std::cell::Cell;
+// run-pass
// compile-flags: -Z chalk
// Test that `Clone` is correctly implemented for builtin types.
+// run-pass
// compile-flags: -Z chalk
trait Foo { }
+// run-pass
// compile-flags: -Z chalk
trait Foo { }
+// run-pass
// compile-flags: -Z chalk
trait Foo { }
+// run-pass
// compile-flags: -Z chalk
trait Foo { }
+// run-pass
// compile-flags: -Z chalk
trait Eq { }
+// run-pass
+
pub fn main() {
let c: char = 'x';
let d: char = 'x';
+// run-pass
+
#![feature(unicode_version)]
/// Tests access to the internal Unicode Version type and value.
+// run-pass
+
#![allow(dead_code)]
// Static recursion check shouldn't fail when given a foreign item (#18279)
+// run-pass
+
const ARR: [usize; 1] = [2];
fn main() {
+// run-pass
// Reported as issue #126, child leaks the string.
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(stable_features)]
#![allow(unused_imports)]
// Test that cleanup scope for temporaries created in a match
+// run-pass
// This test verifies that temporaries created for `while`'s and `if`
// conditions are dropped after the condition is evaluated.
+// run-pass
+
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
+// run-pass
+
#![allow(non_snake_case)]
#![allow(unused_variables)]
// Test that destructors for rvalue temporaries run either at end of
+// run-pass
+
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(unused_variables)]
+// run-pass
// Test that cleanups for the RHS of shortcircuiting operators work.
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(unused_must_use)]
// ignore-emscripten no threads support
+// run-pass
+
#![allow(dead_code)]
// If we use GEPi rather than GEP_tup_like when
// storing closure data (as we used to do), the u64 would
+// run-pass
+
use std::cmp::Ordering;
// Test default methods in PartialOrd and PartialEq
+// run-pass
+
fn main() {
assert_eq!((ToString::to_string as fn(&(dyn ToString+'static)) -> String)(&"foo"),
String::from("foo"));
+// run-pass
+
#![allow(dead_code)]
// Test several functions can be used for constants
// 1. Vec::new()
+// run-pass
+
#![allow(stable_features)]
// ignore-windows - this is a unix-specific test
// ignore-pretty issue #37199
+// run-pass
+
#![allow(stable_features)]
// ignore-windows - this is a unix-specific test
// ignore-cloudabi no processes
+// run-pass
// ignore-android
// ignore-cloudabi
// ignore-emscripten
+// run-pass
+
#![allow(unconditional_recursion)]
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
+
pub fn main() {
assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_string());
assert_eq!(format!(concat!()), "".to_string());
+// run-pass
+
#![feature(const_int_conversion)]
const REVERSE: u32 = 0x12345678_u32.reverse_bits();
+// run-pass
+
const ADD_A: (u32, bool) = 5u32.overflowing_add(2);
const ADD_B: (u32, bool) = u32::max_value().overflowing_add(1);
+// run-pass
+
const LEFT: u32 = 0x10000b3u32.rotate_left(8);
const RIGHT: u32 = 0xb301u32.rotate_right(8);
+// run-pass
// ignore-emscripten no i128 support
#![feature(const_saturating_int_methods)]
+// run-pass
+
#![feature(const_int_sign)]
const NEGATIVE_A: bool = (-10i32).is_negative();
+// run-pass
+
const ADD_A: u32 = 200u32.wrapping_add(55);
const ADD_B: u32 = 200u32.wrapping_add(u32::max_value());
+// run-pass
+
use std::mem;
struct Trivial(u8, f32);
+// run-pass
+
#![allow(unused_must_use)]
#![allow(stable_features)]
#![allow(deprecated)]
+// run-pass
// pretty-expanded FIXME #23616
fn main() {
+// run-pass
// pretty-expanded FIXME #23616
#![feature(box_syntax)]
+// run-pass
// compile-flags:--crate-name crate_name_attr_used -F unused-attributes
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(stable_features)]
// compile-flags:-C target-feature=-crt-static -Z unstable-options
// ignore-musl - requires changing the linker which is hard
+// run-pass
+
#![allow(stable_features)]
// compile-flags:-C target-feature=+crt-static -Z unstable-options
+// run-pass
// Regression test for #15477. This test just needs to compile.
// pretty-expanded FIXME #23616
+// run-pass
+
#![deny(dead_code)]
fn main() {
+// run-pass
// pretty-expanded FIXME #23616
#![deny(dead_code)]
+// run-pass
// This test case makes sure that we don't run into LLVM's dreaded
// "possible ODR violation" assertion when compiling with LTO + Debuginfo.
// It covers cases that have traditionally been prone to cause this error.
+// run-pass
// ignore-emscripten apparently blows the stack
fn f(x: isize) -> isize {
+// run-pass
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
+// run-pass
+
#![feature(associated_type_defaults)]
trait Foo<T: Default + ToString> {
+// run-pass
// pretty-expanded FIXME #23616
trait Foo {
+// run-pass
+
#![allow(dead_code)]
trait Foo {
+// run-pass
+
#![allow(dead_code)]
trait Trait<T> {}
struct Foo<U, V=i32>(U, V) where U: Trait<V>;
+// run-pass
// compile-flags:-Zforce-unstable-if-unmarked
#[deprecated] // should work even with -Zforce-unstable-if-unmarked
+// run-pass
+
#![feature(box_syntax)]
use std::cell::Cell;
+// run-pass
// Test that `&mut T` implements `DerefMut<T>`
+// run-pass
// Test that `&T` and `&mut T` implement `Deref<T>`
+// run-pass
+
use std::rc::Rc;
fn main() {
+// run-pass
// pretty-expanded FIXME #23616
#![feature(box_syntax)]
+// run-pass
+
#![feature(unsize, dispatch_from_dyn, never_type)]
#![allow(dead_code)]
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_assignments)]
#![allow(unused_variables)]
+// run-pass
+
#![allow(unused_imports)]
// Test a regression found when building compiler. The `produce()`
// error type `T` winds up getting unified with result of `x.parse()`;
+// run-pass
+
#![allow(warnings)]
// Here the type of `c` is `Option<?T>`, where `?T` is unconstrained.
+// run-pass
+
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
// aux-build:anon-extern-mod-cross-crate-1.rs
// aux-build:anon-extern-mod-cross-crate-1.rs
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(dead_code)]
#![allow(unreachable_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(unused_mut)]
#![allow(unused_assignments)]
#![allow(unused_variables)]
+// run-pass
+
#![allow(unused_mut)]
#![allow(unused_assignments)]
#![allow(unused_variables)]
+// run-pass
+
#![allow(unused_assignments)]
// edition:2018
// aux-build:edition-kw-macro-2015.rs
+// run-pass
+
#![allow(unused_assignments)]
// edition:2018
// aux-build:edition-kw-macro-2018.rs
+// run-pass
+
pub fn main() {
if 1 == 2 {
assert!((false));
+// run-pass
+
pub fn main() {
assert!(Some(Box::new(())).is_some());
+// run-pass
+
#![allow(unused_variables)]
// pretty-expanded FIXME #23616
+// run-pass
// Test that empty type parameter list (<>) is synonymous with
// no type parameters at all
+// run-pass
+
#![feature(global_asm)]
#[cfg(target_arch = "x86")]
+// run-pass
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
+// run-pass
// Ignore this test on Android, because it segfaults there.
// ignore-android
+// run-pass
+
#![allow(unused_variables)]
#![allow(deprecated)]
// ignore-cloudabi no environment variables present
+// run-pass
+
#![allow(unused_imports)]
// ignore-windows
+// run-pass
// ignore-cloudabi no env vars
// ignore-wasm32-bare no env vars
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_variables)]
// Checks if the correct registers are being used to pass arguments
+// run-pass
+
#[derive(PartialEq, Debug)]
struct Bar;
#[derive(Debug)]
+// run-pass
+
#![allow(unused_assignments)]
#![allow(unknown_lints)]
+// run-pass
// exec-env:TEST_EXEC_ENV=22
// ignore-cloudabi no env vars
// ignore-emscripten FIXME: issue #31622
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_assignments)]
#![allow(unused_variables)]
+// run-pass
+
#![allow(unused_must_use)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(non_upper_case_globals)]
#![allow(dead_code)]
// Test that a glob-export functions as an import
+// run-pass
// pretty-expanded FIXME #23616
use m::f;
+// run-pass
+
mod foo {
pub mod bar {
pub fn y() { super::super::foo::x(); }
+// run-pass
+
pub mod foo {
pub fn x() { ::bar::x(); }
}
+// run-pass
+
fn test_fn() {
fn ten() -> isize { return 10; }
let rs = ten;
+// run-pass
+
#![feature(box_syntax)]
fn test_generic<T, F>(expected: Box<T>, eq: F) where T: Clone, F: FnOnce(Box<T>, Box<T>) -> bool {
+// run-pass
+
#![feature(box_syntax)]
fn test_generic<T, F>(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool {
+// run-pass
+
fn test_generic<T: Clone, F>(expected: T, eq: F) where F: FnOnce(T, T) -> bool {
let actual: T = { expected.clone() };
assert!(eq(expected, actual));
+// run-pass
// Regression test for issue #377
+// run-pass
+
#![feature(box_syntax)]
pub fn main() { let x: Box<_> = { box 100 }; assert_eq!(*x, 100); }
+// run-pass
+
#![allow(dead_code)]
+// run-pass
+
fn f(arg: &mut A) {
arg.a = 100;
}
+// run-pass
+
#![allow(dead_code)]
// Issue #521
+// run-pass
+
fn test_int() {
fn f() -> isize { 10 }
assert_eq!(f(), 10);
+// run-pass
+
fn test_generic<T, F>(expected: T, not_expected: T, eq: F) where
T: Clone,
F: FnOnce(T, T) -> bool,
+// run-pass
// When all branches of an if expression result in panic, the entire if
// expression results in panic.
+// run-pass
+
fn test_if_panic() {
let x = if false { panic!() } else { 10 };
assert_eq!(x, 10);
+// run-pass
+
#![feature(box_syntax)]
// Tests for if as expressions returning boxed types
+// run-pass
// Tests for if as expressions
fn test_if() { let rs: bool = if true { true } else { false }; assert!((rs)); }
+// run-pass
// Regression test for issue #762
// pretty-expanded FIXME #23616
+// run-pass
+
static FOO : &'static str = concat!(concat!("hel", "lo"), "world");
pub fn main() {
+// run-pass
+
pub fn main() {
let mut x = 0;
{
+// run-pass
+
#![allow(dead_code)]
+// run-pass
+
pub fn main() {
assert!(option_env!("__HOPEFULLY_DOESNT_EXIST__").is_none());
}
+// run-pass
+
fn f(x: isize) -> isize {
// println!("in f:");
+// run-pass
// compile-flags: -Clto=fat
// no-prefer-dynamic
+// run-pass
+
#![feature(raw)]
use std::mem;
+// run-pass
// ignore-windows
// ignore-android
// ignore-cloudabi no processes
+// run-pass
// pretty-expanded FIXME #23616
pub fn main() {
+// run-pass
+
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(non_upper_case_globals)]
pub const arg0: u8 = 1;
+// run-pass
+
pub fn main() {
use std::f64;
let x = "NaN".to_string();
+// run-pass
// ignore-emscripten no no_std executables
#![feature(lang_items, start)]
+// run-pass
+
use std::cell::RefCell;
pub fn main() {
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(stable_features)]
// Issue 4691: Ensure that functional-struct-updates operates
+// run-pass
+
fn ho<F>(f: F) -> isize where F: FnOnce(isize) -> isize { let n: isize = f(3); return n; }
fn direct(x: isize) -> isize { return x + 1; }
+// run-pass
+
fn f() -> isize { return 42; }
pub fn main() {
+// run-pass
// Regression test for broken MIR error (#61442)
// Due to the two possible evaluation orders for
// a '+=' expression (depending on whether or not the 'AddAssign' trait
+// run-pass
// Regression test for incorrect DropAndReplace behavior introduced in #60840
// and fixed in #61373. When combined with the optimization implemented in
// #60187, this produced incorrect code for generators when a saved local was
+// run-pass
+
#![feature(generators)]
fn main() {
+// run-pass
// Test that we don't duplicate storage for a variable that is moved to another
// binding. This used to happen in the presence of unwind and drop edges (see
// `complex` below.)
+// run-pass
+
pub fn f() -> isize { return 1; }
pub mod foo {
+// run-pass
+
#![allow(non_snake_case)]
#[derive(Copy, Clone)]
+// run-pass
+
#![allow(non_shorthand_field_patterns)]
#[derive(Copy, Clone)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![allow(unused_mut)]
+// run-pass
+
pub fn main() {
println!("hello, world");
}
+// run-pass
+
#![allow(non_camel_case_types)]
// A test of the macro system. Can we do HTML literals?
+// run-pass
+
pub fn main() {
let i: isize = if false { panic!() } else { 5 };
println!("{}", i);
+// run-pass
+
fn even(x: usize) -> bool {
if x < 2 {
return false;
+// run-pass
+
#![allow(unused_parens)]
// pretty-expanded FIXME #23616
warning: unreachable block in `if` expression
- --> $DIR/if-ret.rs:4:24
+ --> $DIR/if-ret.rs:6:24
|
LL | fn foo() { if (return) { } }
| ^^^
+// run-pass
+
#![deny(warnings)]
#![allow(unused_must_use)]
#![allow(unused_features)]
+// run-pass
+
#![allow(non_shorthand_field_patterns)]
#![allow(dead_code)]
#![allow(unused_variables)]
+// run-pass
// Test that we can call static methods on ! both directly and when it appears in a generic
#![feature(never_type)]
+// run-pass
// Ensure that a user-defined type admits multiple inherent methods
// with the same name, which can be called on values that have a
// precise enough type to allow distinguishing between the methods.
+// run-pass
+
mod foo {
pub struct Point {
pub x: i32,
+// run-pass
// aux-build:impl_privacy_xc_1.rs
// pretty-expanded FIXME #23616
+// run-pass
// aux-build:impl_privacy_xc_2.rs
extern crate impl_privacy_xc_2;
+// run-pass
+
#![feature(impl_trait_in_bindings)]
//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
- --> $DIR/impl-trait-in-bindings.rs:1:12
+ --> $DIR/impl-trait-in-bindings.rs:3:12
|
LL | #![feature(impl_trait_in_bindings)]
| ^^^^^^^^^^^^^^^^^^^^^^
+// run-pass
+
#![allow(warnings)]
#![feature(in_band_lifetimes)]
+// run-pass
// Test old and new syntax for inclusive range patterns.
#![allow(ellipsis_inclusive_range_patterns)]
+// run-pass
+
#![allow(dead_code)]
// issue #680
+// run-pass
// ignore-emscripten
// ignore-wasm32
// ignore-sgx no processes
+// run-pass
+
#![allow(unused_must_use)]
// Makes sure that zero-initializing large types is reasonably fast,
// Doing it incorrectly causes massive slowdown in LLVM during
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![feature(box_syntax)]
+// run-pass
+
#[inline(always)]
fn main() {}
+// run-pass
+
struct Foo;
impl Foo {
+// run-pass
+
mod inner {
pub mod inner2 {
pub fn hello() { println!("hello, modular world"); }
+// run-pass
// aux-build:inner_static.rs
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(unused_mut)]
// ignore-wasm32
// ignore-emscripten
+// run-pass
// aux-build:foreign_lib.rs
// ignore-wasm32-bare no libc to test ffi with
+// run-pass
// pretty-expanded FIXME #23616
pub fn main() {
+// run-pass
+
trait Foo: Fn(i32) -> i32 + Send {}
impl<T: ?Sized + Fn(i32) -> i32 + Send> Foo for T {}
+// run-pass
+
#![feature(step_trait)]
use std::iter::Step;
+// run-pass
+
#![allow(dead_code)]
#[repr(u16)]
enum DeviceKind {
+// run-pass
+
use std::ops::Deref;
pub struct Pin<P>(P);
+// run-pass
//
// compile-flags: -Ccodegen-units=1 -O
+// run-pass
+
pub trait Stream {
type Item;
type Error;
+// run-pass
// rust-lang/rust#54477: runtime bug in the VecDeque library that was
// exposed by this test case, derived from test suite of crates.io
// `collection` crate.
+// run-pass
// Tests that paths in `pub(...)` don't fail HIR verification.
#![allow(unused_imports)]
+// run-pass
+
use std::ops::Deref;
fn foo<P>(_value: <P as Deref>::Target)
+// run-pass
+
trait FromUnchecked {
unsafe fn from_unchecked();
}
+// run-pass
// The const-evaluator was at one point ICE'ing while trying to
// evaluate the body of `fn id` during the `s.id()` call in main.
+// run-pass
+
pub enum Infallible {}
// The check that the `bool` field of `V1` is encoding a "niche variant"
+// run-pass
+
#![feature(core_intrinsics)]
use std::any::type_name;
+// run-pass
+
use std::string::String;
fn test_stack_assign() {
+// run-pass
+
#![allow(dead_code)]
+// run-pass
+
#![allow(dead_code)]
// return -> return
// mod -> module
+// run-pass
+
#![allow(unused_must_use)]
#![allow(dead_code)]
use std::thread;
+// run-pass
// aux-build:kinds_in_metadata.rs
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(unused_mut)]
// This should typecheck even though the type of e is not fully
// resolved when we finish typechecking the ||.
+// run-pass
// shouldn't affect evaluation of $ex:
macro_rules! bad_macro {
($ex:expr) => ({(|_x| { $ex }) (9) })
+// run-pass
+
#![allow(dead_code)]
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_parens)]
// Issue #1818
+// run-pass
+
#![allow(dead_code)]
// Make sure #1399 stays fixed
+// run-pass
+
#![allow(dead_code)]
// Make sure #1399 stays fixed
+// run-pass
+
fn incr(x: &mut isize) -> bool { *x += 1; assert!((false)); return false; }
pub fn main() {
+// run-pass
+
#![allow(unused_mut)]
+// run-pass
// pretty-expanded FIXME #23616
#![feature(box_syntax)]
+// run-pass
// ignore-tidy-cr
// nondoc comment with bare CR: '\r'
+// run-pass
// ignore-tidy-cr ignore-license\r
// ignore-tidy-cr (repeated again because of tidy bug)\r
// license is ignored because tidy can't handle the CRLF here properly.\r
+// run-pass
// Tests that items in subscopes can shadow type parameters and local variables (see issue #23880).
#![allow(unused)]
+// run-pass
// dont-check-compiler-stderr (rust-lang/rust#54222)
// ignore-wasm32-bare no libc to test ffi with
+// run-pass
// aux-build:link-cfg-works-transitive-rlib.rs
// aux-build:link-cfg-works-transitive-dylib.rs
+// run-pass
+
#![allow(non_upper_case_globals)]
#[cfg(not(target_os = "macos"))]
#[link_section=".moretext"]
+// run-pass
// ignore-windows
// ignore-macos
// ignore-emscripten doesn't support this linkage
+// run-pass
// compile-flags: --cap-lints allow
#![deny(warnings)]
+// run-pass
+
#![deny(dead_code)]
trait Foo {
+// run-pass
+
#![deny(dead_code)]
enum Foo {
+// run-pass
+
#![feature(stmt_expr_attributes)]
#![deny(unused_parens)]
+// run-pass
// compile-flags: -D warnings -D unknown-lints
#![allow(unknown_lints)]
+// run-pass
+
#![allow(non_camel_case_types)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(unreachable_code)]
// pretty-expanded FIXME #23616
+// run-pass
// aux-build:llvm_pr32379.rs
// LLVM PR #32379 (https://bugs.llvm.org/show_bug.cgi?id=32379), which
+// run-pass
+
pub fn main() {
if false {
println!("{}", "foobar");
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#[derive(Clone, Debug)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#[derive(Debug)]
+// run-pass
+
#[derive(Debug)]
enum Numbers {
Three
+// run-pass
// ignore-windows
// ignore-emscripten no threads support
// exec-env:RUSTC_LOG=debug
+// run-pass
// exec-env:RUSTC_LOG=std::ptr
// In issue #9487, it was realized that std::ptr was invoking the logging
+// run-pass
// pretty-expanded FIXME #23616
#![allow(unused_variables)]
+// run-pass
// compile-flags: -C lto -C codegen-units=8
// no-prefer-dynamic
+// run-pass
// compile-flags: -C lto
// no-prefer-dynamic
// ignore-emscripten no threads support
+// run-pass
// Test for a specific corner case: when we compute the LUB of two fn
// types and their parameters have unbound variables. In that case, we
// wind up relating those two variables. This was causing an ICE in an
+// run-pass
+
#![allow(unused_parens)]
// aux-build:cond_plugin.rs
+// run-pass
// Test that a macro can emit delimiters with nothing inside - `()`, `{}`
// aux-build:hello_macro.rs
+// run-pass
+
macro_rules! test {
(
fn fun() -> Option<Box<$t:ty>>;
+// run-pass
+
#![allow(non_snake_case)]
trait Product {
fn product(&self) -> isize;
+// run-pass
// Check that method matching does not make "guesses" depending on
// Deref impls that don't eventually end up being picked.
+// run-pass
+
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
use std::fmt::Debug;
use std::cmp::{self, PartialOrd, Ordering};
+// run-pass
// Test that subtyping the body of a static doesn't cause an ICE.
fn foo(_ : &()) {}
+// run-pass
+
pub type T = f32;
+// run-pass
+
pub type T = f64;
+// run-pass
+
pub type T = float;
+// run-pass
+
#![allow(non_camel_case_types)]
+// run-pass
+
#![allow(non_upper_case_globals)]
/*!
* On x86_64-linux-gnu and possibly other platforms, structs get 8-byte "preferred" alignment,
+// run-pass
// pretty-expanded FIXME #23616
trait Serializer {
+// run-pass
// compile-flags:--test
// ignore-emscripten
// ignore-sgx no thread sleep support
+// run-pass
// aux-build:msvc-data-only-lib.rs
extern crate msvc_data_only_lib;
+// run-pass
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
+// run-pass
//
// Test that multibyte characters don't crash the compiler
+// run-pass
// Test that we correctly ignore the blanket impl
// because (in this case) `T` does not impl `Clone`.
//
+// run-pass
+
use std::fmt::Debug;
trait MyTrait<T> {
+// run-pass
+
use std::fmt::Debug;
use std::default::Default;
+// run-pass
// pretty-expanded FIXME #23616
/*
+// run-pass
+
#![allow(dead_code)]
use std::mem::{size_of, align_of};
+// run-pass
+
#![feature(box_syntax)]
fn f(mut y: Box<isize>) {
+// run-pass
// pretty-expanded FIXME #23616
pub fn main() {
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
+
#![feature(start)]
#[start]
+// run-pass
+
pub fn main() {
match -5 {
-5 => {}
+// run-pass
// pretty-expanded FIXME #23616
/* This test checks that nested comments are supported
+// run-pass
+
#![allow(non_camel_case_types)]
pub fn main() {
+// run-pass
// Make sure nested functions are separate, even if they have
// equal name.
//
+// run-pass
// aux-build:nested_item.rs
+// run-pass
+
#![allow(unused_variables)]
#![allow(unreachable_code)]
// Test that we can extract a ! through pattern matching then use it as several different types.
+// run-pass
+
#![feature(never_type)]
#![allow(dead_code)]
#![allow(path_statements)]
+// run-pass
// Test that having something of type ! doesn't screw up type-checking and that it coerces to the
// LUB type of the other match arms.
+// run-pass
// pretty-expanded FIXME #23616
/* Any copyright is dedicated to the Public Domain.
+// run-pass
+
#![feature(box_syntax)]
fn f(x: Box<isize>) {
+// run-pass
+
use std::fmt;
struct Thingy {
+// run-pass
+
pub fn main() {
println!("Hello world!");
}
+// run-pass
+
static FOO: isize = 3;
pub fn main() {
+// run-pass
+
pub fn main() {
let s = "\u{2603}";
assert_eq!(s, "☃");
+// run-pass
// pretty-expanded FIXME #23616
fn main() {
+// run-pass
+
#![allow(dead_code)]
// Test that the lambda kind is inferred correctly as a return
// expression
+// run-pass
+
#![allow(dead_code)]
// Test that the lambda kind is inferred correctly as a return
// expression
+// run-pass
// Tests for the new |args| expr lambda syntax
+// run-pass
+
#![allow(non_camel_case_types)]
+// run-pass
+
#[derive(PartialEq, Debug)]
struct Foo(usize);
+// run-pass
+
#![allow(non_camel_case_types)]
#[derive(Copy, Clone)]
struct mytype(Mytype);
+// run-pass
+
#![allow(improper_ctypes)]
#![allow(dead_code)]
// Issue #901
+// run-pass
+
#![allow(stable_features)]
#![feature(no_core, core)]
#![no_core]
+// run-pass
+
#![allow(dead_code, unused_imports)]
#![feature(no_core)]
#![no_core]
+// run-pass
// compile-flags: -Z no-landing-pads -C codegen-units=1
// ignore-emscripten no threads support
+// run-pass
+
#![no_std]
extern crate std;
+// run-pass
+
#![no_std]
extern crate std;
+// run-pass
+
#![no_std]
extern crate std;
+// run-pass
// ignore-android
// ignore-cloudabi no processes
// ignore-emscripten no processes
+// run-pass
// pretty-expanded FIXME #23616
macro_rules! quote_tokens { () => (()) }
+// run-pass
+
struct X {
repr: isize
}
+// run-pass
//
// ignore-test: not a test, used by non_modrs_mods.rs
+// run-pass
+
pub fn foo() {}
+// run-pass
+
pub mod innest;
+// run-pass
+
pub fn foo() {}
+// run-pass
+
pub fn foo() {}
+// run-pass
+
pub mod innest;
+// run-pass
+
pub fn foo() {}
+// run-pass
+
pub mod innest;
+// run-pass
+
pub fn foo() {}
+// run-pass
+
pub fn foo() {}
+// run-pass
+
pub mod innest;
+// run-pass
+
pub mod inner_modrs_mod;
pub mod inner_foors_mod;
pub mod inline {
+// run-pass
+
pub mod inner_modrs_mod;
+// run-pass
+
pub fn foo() {}
+// run-pass
+
pub mod innest;
+// run-pass
+
pub fn main()
{
let all_nuls1 = "\0\x00\u{0}\u{0}";
+// run-pass
// #11303, #11040:
// This would previously crash on i686 Linux due to abi differences
// between returning an Option<T> and T, where T is a non nullable
+// run-pass
+
#![feature(box_syntax)]
// Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions,
+// run-pass
+
#![allow(dead_code)]
use std::mem;
+// run-pass
// Test that `Box<Test>` is equivalent to `Box<Test+'static>`, both in
// fields and fn arguments.
+// run-pass
// Test that the lifetime from the enclosing `&` is "inherited"
// through the `Box` struct.
+// run-pass
// Test that the lifetime of the enclosing `&` is used for the object
// lifetime bound.
+// run-pass
// Test that the lifetime of the enclosing `&` is used for the object
// lifetime bound.
+// run-pass
// Test for using an object with an associated type binding as the
// instantiation for a generic type with a bound.
+// run-pass
// Test that we can coerce an `@Object` to an `&Object`
+// run-pass
// Test invoked `&self` methods on owned objects where the values
// closed over do not contain managed values, and thus the boxes do
// not have headers.
+// run-pass
// Test invoked `&self` methods on owned objects where the values
// closed over contain managed values. This implies that the boxes
// will have headers that must be skipped over.
+// run-pass
// Testing guarantees provided by once functions.
+// run-pass
// Why one-tuples? Because macros.
+// run-pass
+
fn main() {
// test compound assignment operators with ref as right-hand side,
// for each operator, with various types as operands.
+// run-pass
+
pub fn main() {
let mut x: isize = 1;
x *= 2;
+// run-pass
// Testcase for issue #130, operator associativity.
pub fn main() { assert_eq!(3 * 5 / 2, 7); }
+// run-pass
// Test that we can overload the `+` operator for points so that two
// points can be added, and a point can be added to an integer.
+// run-pass
+
#![allow(unused_variables)]
use std::cmp;
use std::ops;
+// run-pass
+
#![crate_name="foo"]
use std::mem::size_of;
+// run-pass
+
#![crate_name="foo"]
use std::mem::size_of;
+// run-pass
+
pub fn main() {
let thing = "{{ f }}";
let f = thing.find("{{");
+// run-pass
+
#![allow(non_camel_case_types)]
use std::cell::Cell;
+// run-pass
+
#![allow(unused_must_use)]
#![allow(unconditional_recursion)]
// ignore-android: FIXME (#20004)
+// run-pass
+
#[derive(Copy, Clone)]
pub struct Foo {
f1: isize,
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_assignments)]
#![allow(unknown_lints)]
+// run-pass
+
#![allow(unused_must_use)]
// Regression test for issue #152.
pub fn main() {
+// run-pass
+
#![feature(overlapping_marker_traits)]
#![feature(specialization)]
+// run-pass
// Tests for RFC 1268: we allow overlapping impls of marker traits,
// that is, traits with #[marker]. In this case, a type `T` is
// `MyMarker` if it is either `Debug` or `Display`.
+// run-pass
// pretty-expanded FIXME #23616
fn f<T: 'static>(_x: T) {}
+// run-pass
// If a struct is packed and its last field has drop glue, then that
// field needs to be Sized (to allow it to be destroyed out-of-place).
//
+// run-pass
// ignore-wasm32-bare always compiled as panic=abort right now and this requires unwinding
// This test checks that instantiating an uninhabited type via `mem::{uninitialized,zeroed}` results
// in a runtime panic.
+// run-pass
+
pub fn main() {
let x = true;
if x { let mut i = 10; while i > 0 { i -= 1; } }
+// run-pass
// pretty-expanded FIXME #23616
trait Foo {
+// run-pass
+
#![allow(dead_code)]
#![allow(unreachable_code)]
+// run-pass
// Beware editing: it has numerous whitespace characters which are important.
// It contains one ranges from the 'PATTERN_WHITE_SPACE' property outlined in
// http://unicode.org/Public/UNIDATA/PropList.txt
+// run-pass
// pretty-expanded FIXME #23616
mod foo {
+// run-pass
+
#![allow(deprecated)]
// ignore-cloudabi no files or I/O
// ignore-wasm32-bare no files or I/O
+// run-pass
// ignore-cloudabi spawning processes is not supported
// ignore-emscripten spawning processes is not supported
// ignore-sgx no processes
+// run-pass
// aux-build:add-impl.rs
#[macro_use]
+// run-pass
// aux-build:append-impl.rs
#![allow(warnings)]
+// run-pass
// aux-build:attr-args.rs
#![allow(warnings)]
+// run-pass
// aux-build:attr-cfg.rs
// revisions: foo bar
+// run-pass
// aux-build:attr-on-trait.rs
extern crate attr_on_trait;
+// run-pass
// aux-build:attr-stmt-expr.rs
#![feature(stmt_expr_attributes, proc_macro_hygiene)]
+// run-pass
// aux-build:bang-macro.rs
#![feature(proc_macro_hygiene)]
+// run-pass
+
#![allow(unused_variables)]
#![allow(unused_imports)]
// aux-build:call-site.rs
+// run-pass
// aux-build:count_compound_ops.rs
#![feature(proc_macro_hygiene)]
+// run-pass
// aux-build:double.rs
// aux-build:external-crate-var.rs
+// run-pass
// aux-build:custom-attr-only-one-derive.rs
#![feature(rust_2018_preview)]
+// run-pass
+
#![allow(dead_code)]
// aux-build:derive-attr-cfg.rs
+// run-pass
// aux-build:derive-b.rs
extern crate derive_b;
+// run-pass
+
#![allow(path_statements)]
#![allow(dead_code)]
// aux-build:derive-same-struct.rs
+// run-pass
// no-prefer-dynamic
// compile-flags: --test
+// run-pass
+
#![allow(dead_code)]
// aux-build:derive-two-attrs.rs
+// run-pass
+
#![allow(unused_variables)]
// aux-build:derive-union.rs
+// run-pass
+
#![allow(unused_imports)]
// aux-build:empty-crate.rs
+// run-pass
// aux-build:expand-with-a-macro.rs
// ignore-wasm32-bare compiled with panic=abort by default
+// run-pass
// aux-build:gen-lifetime-token.rs
extern crate gen_lifetime_token as bar;
+// run-pass
+
#![allow(unused_macros)]
// aux-build:hygiene_example_codegen.rs
// aux-build:hygiene_example.rs
+// run-pass
+
#![allow(dead_code)]
// aux-build:issue-39889.rs
+// run-pass
// aux-build:issue-42708.rs
#![feature(decl_macro)]
+// run-pass
+
#![allow(path_statements)]
// aux-build:issue-50061.rs
+// run-pass
+
#![allow(unused_variables)]
// aux-build:lifetimes.rs
+// run-pass
+
#![allow(path_statements)]
#![allow(dead_code)]
// aux-build:derive-atob.rs
+// run-pass
// aux-build:test-macros.rs
// ignore-wasm32
+// run-pass
// aux-build:modify-ast.rs
extern crate modify_ast;
+// run-pass
// aux-build:negative-token.rs
#![feature(proc_macro_hygiene)]
+// run-pass
// aux-build:not-joint.rs
extern crate not_joint as bar;
+// run-pass
+
#![allow(unused_must_use)]
#![allow(path_statements)]
// aux-build:derive-a.rs
+// run-pass
// aux-build:span-api-tests.rs
// aux-build:span-test-macros.rs
+// run-pass
+
#![allow(dead_code)]
// aux-build:derive-nothing.rs
+// run-pass
// aux-build:proc_macro_def.rs
// ignore-cross-compile
+// run-pass
// Regression test for #31849: the problem here was actually a performance
// cliff, but I'm adding the test for reference.
+// run-pass
+
#![allow(dead_code)]
// Regression test for #37154: the problem here was that the cache
// results in a false error because it was caching placeholder results
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unreachable_code)]
+// run-pass
+
#![allow(unused_variables)]
// Test coercions between pointers which don't do anything fancy like unsizing.
+// run-pass
+
#![allow(dead_code)]
// Check that functions can modify local state.
+// run-pass
+
fn something<F>(f: F) where F: FnOnce() { f(); }
pub fn main() {
something(|| println!("hi!") );
+// run-pass
+
#![allow(unused_must_use)]
// Make sure the type inference for the new range expression work as
// good as the old one. Check out issue #21672, #21595 and #21649 for
+// run-pass
+
#![allow(unused_comparisons)]
#![allow(dead_code)]
#![allow(unused_mut)]
+// run-pass
// Test inclusive range syntax.
#![feature(range_is_empty)]
+// run-pass
+
#![allow(unused_comparisons)]
// Test that you only need the syntax gate if you don't mention the structs.
// (Obsoleted since both features are stabilized)
+// run-pass
// Test that the precedence of ranges is correct
+// run-pass
// check raw fat pointer ops
use std::mem;
+// run-pass
+
#![allow(non_camel_case_types)]
#![feature(box_syntax)]
+// run-pass
// ignore-wasm32-bare compiled with panic=abort by default
// aux-build:reachable-unnameable-items.rs
+// run-pass
+
#![feature(staged_api)]
#![stable(feature = "a", since = "b")]
+// run-pass
+
#![allow(dead_code)]
+// run-pass
// alloc::heap::reallocate test.
//
// Ideally this would be revised to use no_std, but for now it serves
+// run-pass
// aux-build:reexport-should-still-link.rs
// pretty-expanded FIXME #23616
+// run-pass
// pretty-expanded FIXME #23616
mod a {
+// run-pass
// compile-flags:--test
#![reexport_test_harness_main = "test_main"]
+// run-pass
+
static A: usize = 42;
static B: usize = A;
+// run-pass
+
static FOO: [isize; 4] = [32; 4];
static BAR: [isize; 4] = [32, 32, 32, 32];
+// run-pass
// compile-flags: -O
#![allow(dead_code)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
+// run-pass
// check that type parameters can't "shadow" qualified paths.
fn check<Clone>(_c: Clone) {
+// run-pass
+
#![allow(non_camel_case_types)]
use std::cell::Cell;
+// run-pass
+
#![allow(non_camel_case_types)]
use std::cell::Cell;
+// run-pass
+
#[derive(Copy, Clone, Debug, PartialEq)]
struct BadNumErr;
+// run-pass
+
fn my_err(s: String) -> ! { println!("{}", s); panic!(); }
fn okay(i: usize) -> isize {
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
// pretty-expanded FIXME #23616
fn f() { let x: () = (); return x; }
+// run-pass
// Test that using rlibs and rmeta dep crates work together. Specifically, that
// there can be both an rmeta and an rlib file and rustc will prefer the rlib.
+// run-pass
// ignore-cloudabi spawning processes is not supported
// ignore-emscripten spawning processes is not supported
// ignore-sgx no processes
+// run-pass
// This test is just checking that we won't ICE if logging is turned
// on; don't bother trying to compare that (copious) output. (Note
// also that this test potentially silly, since we do not build+test
+// run-pass
+
use std::cell::Cell;
const NONE_CELL_STRING: Option<Cell<String>> = None;
+// run-pass
+
#![allow(unused_imports)]
// ignore-cloudabi can't run commands
// ignore-emscripten can't run commands
+// run-pass
+
#![allow(unused_must_use)]
pub fn main() {
+// run-pass
+
pub fn main() {
assert!(("hello".to_string() < "hellr".to_string()));
assert!(("hello ".to_string() > "hello".to_string()));
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
fn foo(c: Vec<isize> ) {
+// run-pass
+
#![allow(unused_imports)]
mod foo {
pub fn f() {}
#!/usr/bin/env rustx
-// http://rust-lang.org/COPYRIGHT.
-//
+
+// run-pass
pub fn main() { println!("Hello World"); }
+// run-pass
// Previously memory for alternate signal stack have been unmapped during
// main thread exit while still being in use by signal handlers. This test
// triggers this situation by sending signal from atexit handler.
+// run-pass
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
+// run-pass
+
#![allow(unused_must_use)]
// Be sure that when a SIGPIPE would have been received that the entire process
// doesn't die in a ball of fire, but rather it's gracefully handled.
+// run-pass
+
#![allow(unused_mut)]
+// run-pass
+
#![feature(global_asm)]
#![feature(naked_functions)]
#![allow(dead_code)]
+// run-pass
+
#![allow(non_camel_case_types)]
enum clam<T> { a(T, isize), b, }
+// run-pass
+
#![allow(dead_code)]
// Possibly-dynamic size of typaram should be cleared at pointer boundary.
+// run-pass
+
#![allow(dead_code)]
// Possibly-dynamic size of typaram should be cleared at pointer boundary.
+// run-pass
// ignore-emscripten no threads support
// ignore-sgx no thread sleep support
+// run-pass
// ignore-tidy-linelength
// Issue #16624
+// run-pass
// ignore-tidy-linelength
// Issue #16624
+// run-pass
// ignore-cloudabi no std::env
#![allow(stable_features)]
+// run-pass
// Issue #2040
+// run-pass
// ignore-arm
// ignore-aarch64
// ignore-mips
+// run-pass
// ignore-arm
// ignore-aarch64
// ignore-mips
+// run-pass
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
+// run-pass
+
pub fn main() {
let a: String = "hello".to_string();
let b: String = "world".to_string();
+// run-pass
+
pub fn main() {
let a: String = "this \
is a test".to_string();
+// run-pass
// Ensure that both `Box<dyn Error + Send + Sync>` and `Box<dyn Error>` can be
// obtained from `String`.
+// run-pass
+
fn main() {
let x = "\\\\\
";
+// run-pass
+
fn size_of_val<T>(_: &T) -> usize {
std::mem::size_of::<T>()
}
+// run-pass
+
#![allow(non_camel_case_types)]
+// run-pass
+
#![allow(non_upper_case_globals)]
#![allow(dead_code)]
// exec-env:RUST_MIN_STACK=16000000
+// run-pass
+
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
pub fn main() {
let f = 1_usize as *const String;
println!("{:?}", f as isize);
+// run-pass
// note that these aux-build directives must be in this order
// aux-build:svh-a-base.rs
// aux-build:svh-b.rs
+// run-pass
+
use std::mem::swap;
pub fn main() {
+// run-pass
+
use std::mem::swap;
pub fn main() {
+// run-pass
+
#![allow(dead_code)]
// Issue #5041 - avoid overlapping memcpy when src and dest of a swap are the same
+// run-pass
// use of tail calls causes arg slot leaks, issue #160.
// pretty-expanded FIXME #23616
+// run-pass
+
fn checktrue(rs: bool) -> bool { assert!((rs)); return true; }
pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); }
+// run-pass
+
pub fn main() { assert!((even(42))); assert!((odd(45))); }
fn even(n: isize) -> bool { if n == 0 { return true; } else { return odd(n - 1); } }
+// run-pass
// ignore-android needs extra network permissions
// ignore-cloudabi no global network namespace access
// ignore-emscripten no threads or sockets support
+// run-pass
// ignore-emscripten no threads support
// Issue #787
+// run-pass
// compile-flags: --test
#![deny(dead_code)]
+// run-pass
// ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: --test
#![feature(allow_fail)]
+// run-pass
+
#![feature(test)]
// compile-flags: --test
+// run-pass
// compile-flags: --test
#![feature(main)]
+// run-pass
// compile-flags: --test
#![deny(dead_code)]
+// run-pass
// compile-flags: --test
#![feature(main)]
+// run-pass
// compile-flags:--test
// Building as a test runner means that a synthetic main will be run,
// not ours
+// run-pass
// compile-flags: --test
#![feature(start)]
+// run-pass
// ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: --test
#[test]
+// run-pass
// compile-flags: --cfg test
// Make sure `--cfg test` does not inject test harness
+// run-pass
// compile-flags: -Z thinlto -C codegen-units=2
#[global_allocator]
+// run-pass
+
#![no_std]
extern crate std;
+// run-pass
// Scoped attributes should not trigger an unused attributes lint.
#![deny(unused_attributes)]
+// run-pass
+
#![deny(unknown_lints)]
#[allow(clippy::almost_swapped)]
+// run-pass
+
#![feature(rust_2018_preview)]
#![deny(unknown_lints)]
+// run-pass
// pretty-expanded FIXME #23616
#![feature(slice_patterns)]
+// run-pass
// Check that trait-objects without a principal codegen properly.
use std::sync::atomic::{AtomicUsize, Ordering};
+// run-pass
+
#![feature(trait_alias)]
mod inner {
+// run-pass
// Issue #7988
// Transmuting non-immediate type to immediate type
+// run-pass
+
#![feature(specialization)]
trait Specializable { type Output; }
+// run-pass
+
#![allow(unused_must_use)]
/*
This is about the simplest program that can successfully send a
+// run-pass
// Test that all coercions can actually be done using casts (modulo the lints).
#![allow(trivial_casts, trivial_numeric_casts)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
// compile-flags: --edition 2018
+// run-pass
+
#![allow(unused_must_use)]
use std::convert::TryFrom;
+// run-pass
+
#![allow(non_camel_case_types)]
// compile-flags: --edition 2015
+// run-pass
+
#![feature(try_trait)]
use std::ops::Try;
+// run-pass
+
#![allow(non_upper_case_globals)]
#![allow(dead_code)]
// `expr?` expands to:
+// run-pass
+
#![allow(dead_code)]
// ignore-cloudabi no std::fs
+// run-pass
+
#![allow(stable_features)]
// ignore-cloudabi no processes
// ignore-emscripten no processes
+// run-pass
// This test relies on `TryFrom` being blanket impl for all `T: Into`
// and `TryInto` being blanket impl for all `U: TryFrom`
+// run-pass
+
#![allow(non_camel_case_types)]
type point = (isize, isize);
+// run-pass
+
struct Foo<'a>(&'a [isize]);
fn main() {
+// run-pass
+
struct Point(isize, isize);
fn main() {
+// run-pass
+
#![allow(dead_code)]
use std::any::type_name;
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_variables)]
// Type ascription doesn't lead to unsoundness
+// run-pass
// Test that we can't ignore lifetimes by going through Any.
use std::any::Any;
+// run-pass
// Test that type IDs correctly account for higher-rank lifetimes
// Also acts as a regression test for an ICE (issue #19791)
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
+
#![allow(non_upper_case_globals)]
#![allow(dead_code)]
#![allow(unused_assignments)]
+// run-pass
+
struct A { a: isize }
fn a(a: A) -> isize { return a.a; }
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
+// run-pass
+
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(dead_code)]
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![feature(never_type)]
+// run-pass
// pretty-expanded FIXME #23616
use std::ptr;
+// run-pass
+
unsafe fn call_unsafe(func: unsafe fn() -> ()) -> () {
func()
}
+// run-pass
// This tests reification from safe function to `unsafe fn` pointer
fn do_nothing() -> () {}
+// run-pass
+
#![allow(dead_code)]
// This test checks that the `_` type placeholder works
// correctly for enabling type inference.
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
+// run-pass
+
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
+// run-pass
+
#![allow(deprecated)]
// aux-build:typeid-intrinsic-aux1.rs
// aux-build:typeid-intrinsic-aux2.rs
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_assignments)]
#![allow(unknown_lints)]
+// run-pass
+
pub fn main() {
let (x, y) = (10, 20);
let z = x + y;
+// run-pass
+
use std::borrow::{Cow, ToOwned};
use std::default::Default;
use std::iter::FromIterator;
+// run-pass
// pretty-expanded FIXME #23616
trait Foo<T> {
+// run-pass
+
pub fn main() {
let a = 1;
let a_neg: i8 = -a;
+// run-pass
+
#![allow(dead_code)]
struct Foo<'a>(&'a u8);
+// run-pass
+
trait Tr : Sized {
fn _method_on_numbers(self) {}
}
+// run-pass
// aux-build:issue-53691.rs
extern crate issue_53691;
+// run-pass
// Tests that the tail expr in null() has its type
// unified with the type *T, and so the type variable
// in that type gets resolved.
+// run-pass
// Test the uninit() construct returning various empty types.
// pretty-expanded FIXME #23616
+// run-pass
+
#![allow(unused_assignments)]
#![allow(unknown_lints)]
// pretty-expanded FIXME #23616
+// run-pass
// pretty-expanded FIXME #23616
fn good(_a: &isize) {
+// run-pass
+
#![allow(unused_must_use)]
#![allow(unreachable_code)]
+// run-pass
+
#![allow(unused_must_use)]
#![allow(dead_code)]
+// run-pass
// Check that safe fns are not a subtype of unsafe fns.
+// run-pass
+
#![allow(dead_code)]
//
// See also: compile-fail/unsafe-fn-called-from-safe.rs
+// run-pass
+
#![allow(dead_code)]
//
// See also: compile-fail/unsafe-fn-called-from-safe.rs
+// run-pass
+
fn f(x: *const isize) {
unsafe {
assert_eq!(*x, 3);
+// run-pass
+
#![feature(unsized_locals)]
pub trait Foo {
+// run-pass
+
fn call_it<T>(f: Box<dyn FnOnce() -> T>) -> T {
f()
}
+// run-pass
+
#![feature(unsized_locals)]
pub trait Foo {
+// run-pass
+
#![feature(unsized_locals)]
pub trait Foo {
+// run-pass
+
#![feature(unsized_tuple_coercion)]
use std::collections::HashSet;
+// run-pass
+
#![allow(type_alias_bounds)]
#![allow(dead_code)]
// Test syntax checks for `?Sized` syntax.
+// run-pass
+
#![allow(unconditional_recursion)]
#![allow(dead_code)]
#![allow(unused_variables)]
+// run-pass
// Test structs with always-unsized fields.
+// run-pass
// pretty-expanded FIXME #23616
#![feature(box_syntax)]
+// run-pass
// Issue #3878
// Issue Name: Unused move causes a crash
// Abstract: zero-fill to block after drop
+// run-pass
+
#![allow(non_camel_case_types)]
// ignore-emscripten no threads support
+// run-pass
// ignore-emscripten no threads support
#![feature(box_syntax)]
+// run-pass
// Issue #1706
// pretty-expanded FIXME #23616
+// run-pass
// pretty-expanded FIXME #23616
mod foo {
+// run-pass
+
#![allow(unused_variables)]
pub struct A;
+// run-pass
+
#![allow(unused_imports)]
// pretty-expanded FIXME #23616
+// run-pass
+
mod a {
pub enum B {}
+// run-pass
+
#![allow(stable_features)]
// pretty-expanded FIXME #23616
+// run-pass
// aux-build:inline_dtor.rs
// pretty-expanded FIXME #23616
+// run-pass
// only-x86_64
// aux-build:using-target-feature-unstable.rs
+// run-pass
//
// This file has utf-8 BOM, it should be compiled normally without error.
+// run-pass
+
pub fn main() {
let yen: char = '¥'; // 0xa5
let c_cedilla: char = 'ç'; // 0xe7
+// run-pass
+
use std::str;
pub fn main() {
+// run-pass
//
#![allow(non_snake_case)]
+// run-pass
// ignore-wasm32-bare no libc to test ffi with
#![feature(c_variadic)]
+// run-pass
// Elaborated version of the opening example from RFC 738. This failed
// to compile before variance because invariance of `Option` prevented
// us from approximating the lifetimes of `field1` and `field2` to a
+// run-pass
+
#![allow(warnings)]
use std::iter::Zip;
+// run-pass
+
#![allow(stable_features)]
#![feature(volatile)]
use std::ptr::{read_volatile, write_volatile};
+// run-pass
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
+// run-pass
+
#![allow(dead_code)]
// compile-flags:-D improper-ctypes
+// run-pass
// aux-build:weak-lang-items.rs
// ignore-emscripten no threads support
+// run-pass
+
fn main() {
enum Void {}
std::rc::Weak::<Void>::new();
+// run-pass
// On Windows the GetExitCodeProcess API is used to get the exit code of a
// process, but it's easy to mistake a process exiting with the code 259 as
// "still running" because this is the value of the STILL_ACTIVE constant. Make
+// run-pass
+
#![feature(generators)]
#![allow(non_camel_case_types)]
+// run-pass
+
#![allow(dead_code)]
#![allow(unused_variables)]
// Test that the `wf` checker properly handles bound regions in object
+// run-pass
// Test inherent wrapping_* methods for {i,u}{size,8,16,32,64}.
use std::{i8, i16, i32, i64, isize};
+// run-pass
+
use std::fmt;
use std::io::{self, Error, Write, sink};
+// run-pass
+
#![allow(dead_code)]
use std::sync::Mutex;
+// run-pass
//
#![allow(dead_code)]
// compile-flags: -O
+// run-pass
// ignore-wasm32-bare no libc to test ffi with
// ignore-sgx no libc
// GetLastError doesn't seem to work with stack switching
+// run-pass
+
#![allow(non_camel_case_types)]
pub type HANDLE = usize;
pub type DWORD = u32;
+// run-pass
+
#![allow(unused_must_use)]
#![allow(unused_mut)]
// ignore-emscripten no threads support
+// run-pass
+
#![allow(unused_must_use)]
#![allow(unused_mut)]
// ignore-emscripten no threads support
+// run-pass
+
use std::thread;
pub fn main() {
+// run-pass
// This test checks if an unstable feature is enabled with the -Zcrate-attr=feature(foo) flag. If
// the exact feature used here is causing problems feel free to replace it with another
// perma-unstable feature.