mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Migrate 11 issue tests to specific subdirectories
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
extern crate extern_crate_indirect_fn_ptr_aux_1 as crate1;
|
||||
|
||||
pub static FOO2: crate1::Foo = crate1::FOO;
|
||||
@@ -0,0 +1,3 @@
|
||||
extern crate extern_crate_no_prefer_dynamic_aux_1;
|
||||
|
||||
pub fn bar() {}
|
||||
@@ -0,0 +1,16 @@
|
||||
// issue: rust-lang/rust#14422
|
||||
// Test that we can call an inherently implemented method via aliasing from an extern crate.
|
||||
//@ run-pass
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
//@ aux-build:extern-crate-alias-impl-method-aux.rs
|
||||
|
||||
extern crate extern_crate_alias_impl_method_aux as bug_lib;
|
||||
|
||||
use bug_lib::B;
|
||||
use bug_lib::make;
|
||||
|
||||
pub fn main() {
|
||||
let mut an_A: B = make();
|
||||
an_A.foo();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// issue: rust-lang/rust#13620
|
||||
// Test cross crate resolution of an indirect function pointer
|
||||
//@ run-pass
|
||||
//@ aux-build:extern-crate-indirect-fn-ptr-aux-1.rs
|
||||
//@ aux-build:extern-crate-indirect-fn-ptr-aux-2.rs
|
||||
|
||||
extern crate extern_crate_indirect_fn_ptr_aux_2 as crate2;
|
||||
|
||||
fn main() {
|
||||
(crate2::FOO2.foo)();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// issue: rust-lang/rust#14344
|
||||
// Test that we can depend on an `no-prefer-dynamic` crate.
|
||||
//@ run-pass
|
||||
//@ aux-build:extern-crate-no-prefer-dynamic-aux-1.rs
|
||||
//@ aux-build:extern-crate-no-prefer-dynamic-aux-2.rs
|
||||
|
||||
extern crate extern_crate_no_prefer_dynamic_aux_1;
|
||||
extern crate extern_crate_no_prefer_dynamic_aux_2;
|
||||
|
||||
fn main() {
|
||||
extern_crate_no_prefer_dynamic_aux_1::foo();
|
||||
extern_crate_no_prefer_dynamic_aux_2::bar();
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
// issue: rust-lang/rust#15562
|
||||
// Test resolution of `transmute` in an extern block to rust intrinsics.
|
||||
//@ run-pass
|
||||
//@ aux-build:issue-15562.rs
|
||||
//@ aux-build:extern-transmute-aux.rs
|
||||
|
||||
|
||||
extern crate issue_15562 as i;
|
||||
extern crate extern_transmute_aux as i;
|
||||
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
@@ -1,14 +1,16 @@
|
||||
// issue: rust-lang/rust#13507
|
||||
// Test cross-crate TypeId stability
|
||||
//@ run-pass
|
||||
#![allow(unused_imports)]
|
||||
//@ aux-build:issue-13507.rs
|
||||
//@ aux-build:typeid-cross-crate-aux.rs
|
||||
|
||||
extern crate issue_13507;
|
||||
use issue_13507::testtypes;
|
||||
extern crate typeid_cross_crate_aux;
|
||||
use typeid_cross_crate_aux::testtypes;
|
||||
|
||||
use std::any::TypeId;
|
||||
|
||||
pub fn type_ids() -> Vec<TypeId> {
|
||||
use issue_13507::testtypes::*;
|
||||
use typeid_cross_crate_aux::testtypes::*;
|
||||
vec![
|
||||
TypeId::of::<FooBool>(),
|
||||
TypeId::of::<FooInt>(),
|
||||
@@ -25,12 +27,12 @@ pub fn type_ids() -> Vec<TypeId> {
|
||||
TypeId::of::<FooTuple>(),
|
||||
TypeId::of::<dyn FooTrait>(),
|
||||
TypeId::of::<FooStruct>(),
|
||||
TypeId::of::<FooEnum>()
|
||||
TypeId::of::<FooEnum>(),
|
||||
]
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let othercrate = issue_13507::testtypes::type_ids();
|
||||
let othercrate = typeid_cross_crate_aux::testtypes::type_ids();
|
||||
let thiscrate = type_ids();
|
||||
assert_eq!(thiscrate, othercrate);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// issue: rust-lang/rust#12612
|
||||
// Test that unused `use` declarations involving multiple external crates are handled properly.
|
||||
//@ run-pass
|
||||
#![allow(unused_imports)]
|
||||
//@ aux-build:unused-cross-crate-import-aux-1.rs
|
||||
//@ aux-build:unused-cross-crate-import-aux-2.rs
|
||||
|
||||
extern crate unused_cross_crate_import_aux_1 as foo;
|
||||
extern crate unused_cross_crate_import_aux_2 as bar;
|
||||
|
||||
mod test {
|
||||
use bar::baz;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
// issue: rust-lang/rust#11224
|
||||
// Test that an unused `extern crate` declaration does not crash the compiler.
|
||||
//@ run-pass
|
||||
//@ aux-build:unused-extern-crate-aux.rs
|
||||
|
||||
extern crate unused_extern_crate_aux as unused;
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,3 +0,0 @@
|
||||
extern crate issue_13620_1 as crate1;
|
||||
|
||||
pub static FOO2: crate1::Foo = crate1::FOO;
|
||||
@@ -1,3 +0,0 @@
|
||||
extern crate issue_14344_1;
|
||||
|
||||
pub fn bar() {}
|
||||
@@ -1,7 +0,0 @@
|
||||
//@ run-pass
|
||||
//@ aux-build:issue-11224.rs
|
||||
|
||||
|
||||
extern crate issue_11224 as unused;
|
||||
|
||||
pub fn main() {}
|
||||
@@ -1,11 +0,0 @@
|
||||
//@ run-pass
|
||||
//@ aux-build:issue-11508.rs
|
||||
|
||||
extern crate issue_11508 as rand;
|
||||
|
||||
use rand::{Closed01, random};
|
||||
|
||||
fn main() {
|
||||
let Closed01(val) = random::<Closed01<f32>>();
|
||||
println!("{}", val);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//@ run-pass
|
||||
#![feature(box_patterns)]
|
||||
|
||||
#[derive(Clone)]
|
||||
enum Noun
|
||||
{
|
||||
Atom(isize),
|
||||
Cell(Box<Noun>, Box<Noun>)
|
||||
}
|
||||
|
||||
fn fas(n: &Noun) -> Noun
|
||||
{
|
||||
match n {
|
||||
&Noun::Cell(box Noun::Atom(2), box Noun::Cell(ref a, _)) => (**a).clone(),
|
||||
_ => panic!("Invalid fas pattern")
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
fas(
|
||||
&Noun::Cell(Box::new(Noun::Atom(2)),
|
||||
Box::new(Noun::Cell(Box::new(Noun::Atom(2)), Box::new(Noun::Atom(3)))))
|
||||
);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//@ check-pass
|
||||
//! Ensure the private trait Bar isn't complained about.
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
mod foo {
|
||||
trait Bar { fn bar(&self) { } }
|
||||
impl Bar for i8 { fn bar(&self) { } }
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
@@ -1,23 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(unused_imports)]
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
// this code used to cause an ICE
|
||||
|
||||
use std::marker;
|
||||
|
||||
trait X<T> {
|
||||
fn dummy(&self) -> T { panic!() }
|
||||
}
|
||||
|
||||
struct S<T> {f: Box<dyn X<T>+'static>,
|
||||
g: Box<dyn X<T>+'static>}
|
||||
|
||||
struct F;
|
||||
impl X<isize> for F {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
S {f: Box::new(F), g: Box::new(F) };
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(unused_imports)]
|
||||
//@ aux-build:issue-12612-1.rs
|
||||
//@ aux-build:issue-12612-2.rs
|
||||
|
||||
|
||||
extern crate issue_12612_1 as foo;
|
||||
extern crate issue_12612_2 as bar;
|
||||
|
||||
mod test {
|
||||
use bar::baz;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -1,10 +0,0 @@
|
||||
//@ run-pass
|
||||
//@ aux-build:issue-13620-1.rs
|
||||
//@ aux-build:issue-13620-2.rs
|
||||
|
||||
|
||||
extern crate issue_13620_2 as crate2;
|
||||
|
||||
fn main() {
|
||||
(crate2::FOO2.foo)();
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//@ run-pass
|
||||
//@ aux-build:issue-14344-1.rs
|
||||
//@ aux-build:issue-14344-2.rs
|
||||
|
||||
extern crate issue_14344_1;
|
||||
extern crate issue_14344_2;
|
||||
|
||||
fn main() {
|
||||
issue_14344_1::foo();
|
||||
issue_14344_2::bar();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
//@ run-pass
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
//@ aux-build:issue-14422.rs
|
||||
|
||||
|
||||
extern crate issue_14422 as bug_lib;
|
||||
|
||||
use bug_lib::B;
|
||||
use bug_lib::make;
|
||||
|
||||
pub fn main() {
|
||||
let mut an_A: B = make();
|
||||
an_A.foo();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// issue: rust-lang/rust#11592
|
||||
// Test that the `missing_docs` lint does not trigger for a private trait.
|
||||
//@ check-pass
|
||||
//! Ensure the private trait Bar isn't complained about.
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
mod foo {
|
||||
trait Bar {
|
||||
fn bar(&self) {}
|
||||
}
|
||||
impl Bar for i8 {
|
||||
fn bar(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,24 @@
|
||||
// issue: rust-lang/rust#11552
|
||||
// Test nested box pattern matching inside a larger `match` statement.
|
||||
//@ run-pass
|
||||
#![feature(box_patterns)]
|
||||
|
||||
#[derive(Clone)]
|
||||
enum Noun {
|
||||
Atom(isize),
|
||||
Cell(Box<Noun>, Box<Noun>),
|
||||
}
|
||||
|
||||
fn fas(n: &Noun) -> Noun {
|
||||
match n {
|
||||
&Noun::Cell(box Noun::Atom(2), box Noun::Cell(ref a, _)) => (**a).clone(),
|
||||
_ => panic!("Invalid fas pattern"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
fas(&Noun::Cell(
|
||||
Box::new(Noun::Atom(2)),
|
||||
Box::new(Noun::Cell(Box::new(Noun::Atom(2)), Box::new(Noun::Atom(3)))),
|
||||
));
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// issue: rust-lang/rust#11508
|
||||
// Test pattern matching on a tuple struct defined in an external crate.
|
||||
//@ run-pass
|
||||
//@ aux-build:tuple-struct-cross-crate-aux.rs
|
||||
|
||||
extern crate tuple_struct_cross_crate_aux as rand;
|
||||
|
||||
use rand::{Closed01, random};
|
||||
|
||||
fn main() {
|
||||
let Closed01(val) = random::<Closed01<f32>>();
|
||||
println!("{}", val);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// issue: rust-lang/rust#11677
|
||||
// Test that type inference works correctly for struct fields containing trait objects.
|
||||
//@ run-pass
|
||||
#![allow(unused_imports)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
// this code used to cause an ICE
|
||||
|
||||
use std::marker;
|
||||
|
||||
trait X<T> {
|
||||
fn dummy(&self) -> T {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
struct S<T> {
|
||||
f: Box<dyn X<T> + 'static>,
|
||||
g: Box<dyn X<T> + 'static>,
|
||||
}
|
||||
|
||||
struct F;
|
||||
impl X<isize> for F {}
|
||||
|
||||
fn main() {
|
||||
S { f: Box::new(F), g: Box::new(F) };
|
||||
}
|
||||
Reference in New Issue
Block a user