diff options
Diffstat (limited to 'tests/ui/cross-crate')
39 files changed, 570 insertions, 0 deletions
diff --git a/tests/ui/cross-crate/auxiliary/cci_borrow_lib.rs b/tests/ui/cross-crate/auxiliary/cci_borrow_lib.rs new file mode 100644 index 000000000..7c57a1c66 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/cci_borrow_lib.rs @@ -0,0 +1,3 @@ +pub fn foo(x: &usize) -> usize { + *x +} diff --git a/tests/ui/cross-crate/auxiliary/cci_capture_clause.rs b/tests/ui/cross-crate/auxiliary/cci_capture_clause.rs new file mode 100644 index 000000000..4cd001ecc --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/cci_capture_clause.rs @@ -0,0 +1,10 @@ +use std::thread; +use std::sync::mpsc::{Receiver, channel}; + +pub fn foo<T:'static + Send + Clone>(x: T) -> Receiver<T> { + let (tx, rx) = channel(); + thread::spawn(move|| { + tx.send(x.clone()); + }); + rx +} diff --git a/tests/ui/cross-crate/auxiliary/cci_const.rs b/tests/ui/cross-crate/auxiliary/cci_const.rs new file mode 100644 index 000000000..c83b3f4a5 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/cci_const.rs @@ -0,0 +1,6 @@ +pub extern "C" fn bar() { +} + +pub const foopy: &'static str = "hi there"; +pub const uint_val: usize = 12; +pub const uint_expr: usize = (1 << uint_val) - 1; diff --git a/tests/ui/cross-crate/auxiliary/cci_impl_lib.rs b/tests/ui/cross-crate/auxiliary/cci_impl_lib.rs new file mode 100644 index 000000000..0db0037b2 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/cci_impl_lib.rs @@ -0,0 +1,16 @@ +#![crate_name="cci_impl_lib"] + +pub trait uint_helpers { + fn to<F>(&self, v: usize, f: F) where F: FnMut(usize); +} + +impl uint_helpers for usize { + #[inline] + fn to<F>(&self, v: usize, mut f: F) where F: FnMut(usize) { + let mut i = *self; + while i < v { + f(i); + i += 1; + } + } +} diff --git a/tests/ui/cross-crate/auxiliary/cci_iter_lib.rs b/tests/ui/cross-crate/auxiliary/cci_iter_lib.rs new file mode 100644 index 000000000..60c36bc7d --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/cci_iter_lib.rs @@ -0,0 +1,11 @@ +#![crate_name="cci_iter_lib"] + +#[inline] +pub fn iter<T, F>(v: &[T], mut f: F) where F: FnMut(&T) { + let mut i = 0; + let n = v.len(); + while i < n { + f(&v[i]); + i += 1; + } +} diff --git a/tests/ui/cross-crate/auxiliary/cci_nested_lib.rs b/tests/ui/cross-crate/auxiliary/cci_nested_lib.rs new file mode 100644 index 000000000..23d76ef36 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/cci_nested_lib.rs @@ -0,0 +1,50 @@ +use std::cell::RefCell; + +pub struct Entry<A,B> { + key: A, + value: B +} + +pub struct alist<A,B> { + eq_fn: extern "Rust" fn(A,A) -> bool, + data: Box<RefCell<Vec<Entry<A,B>>>>, +} + +pub fn alist_add<A:'static,B:'static>(lst: &alist<A,B>, k: A, v: B) { + let mut data = lst.data.borrow_mut(); + (*data).push(Entry{key:k, value:v}); +} + +pub fn alist_get<A:Clone + 'static, + B:Clone + 'static>( + lst: &alist<A,B>, + k: A) + -> B { + let eq_fn = lst.eq_fn; + let data = lst.data.borrow(); + for entry in &(*data) { + if eq_fn(entry.key.clone(), k.clone()) { + return entry.value.clone(); + } + } + panic!(); +} + +#[inline] +pub fn new_int_alist<B:'static>() -> alist<isize, B> { + fn eq_int(a: isize, b: isize) -> bool { a == b } + return alist { + eq_fn: eq_int, + data: Box::new(RefCell::new(Vec::new())), + }; +} + +#[inline] +pub fn new_int_alist_2<B:'static>() -> alist<isize, B> { + #[inline] + fn eq_int(a: isize, b: isize) -> bool { a == b } + return alist { + eq_fn: eq_int, + data: Box::new(RefCell::new(Vec::new())), + }; +} diff --git a/tests/ui/cross-crate/auxiliary/cci_no_inline_lib.rs b/tests/ui/cross-crate/auxiliary/cci_no_inline_lib.rs new file mode 100644 index 000000000..177dba217 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/cci_no_inline_lib.rs @@ -0,0 +1,12 @@ +#![crate_name="cci_no_inline_lib"] + + +// same as cci_iter_lib, more-or-less, but not marked inline +pub fn iter<F>(v: Vec<usize> , mut f: F) where F: FnMut(usize) { + let mut i = 0; + let n = v.len(); + while i < n { + f(v[i]); + i += 1; + } +} diff --git a/tests/ui/cross-crate/auxiliary/moves_based_on_type_lib.rs b/tests/ui/cross-crate/auxiliary/moves_based_on_type_lib.rs new file mode 100644 index 000000000..7e7e3b860 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/moves_based_on_type_lib.rs @@ -0,0 +1,17 @@ +#![crate_type="lib"] + +pub struct S { + x: isize, +} + +impl Drop for S { + fn drop(&mut self) { + println!("goodbye"); + } +} + +pub fn f() { + let x = S { x: 1 }; + let y = x; + let _z = y; +} diff --git a/tests/ui/cross-crate/auxiliary/pub_static_array.rs b/tests/ui/cross-crate/auxiliary/pub_static_array.rs new file mode 100644 index 000000000..49cb76921 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/pub_static_array.rs @@ -0,0 +1 @@ +pub static ARRAY: [u8; 1] = [1]; diff --git a/tests/ui/cross-crate/auxiliary/reexported_static_methods.rs b/tests/ui/cross-crate/auxiliary/reexported_static_methods.rs new file mode 100644 index 000000000..cc961625f --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/reexported_static_methods.rs @@ -0,0 +1,43 @@ +pub use sub_foo::Foo; +pub use self::Bar as Baz; +pub use sub_foo::Boz; +pub use sub_foo::Bort; + +pub trait Bar { + fn bar() -> Self; +} + +impl Bar for isize { + fn bar() -> isize { 84 } +} + +pub mod sub_foo { + pub trait Foo { + fn foo() -> Self; + } + + impl Foo for isize { + fn foo() -> isize { 42 } + } + + pub struct Boz { + unused_str: String + } + + impl Boz { + pub fn boz(i: isize) -> bool { + i > 0 + } + } + + pub enum Bort { + Bort1, + Bort2 + } + + impl Bort { + pub fn bort() -> String { + "bort()".to_string() + } + } +} diff --git a/tests/ui/cross-crate/auxiliary/static_init_aux.rs b/tests/ui/cross-crate/auxiliary/static_init_aux.rs new file mode 100644 index 000000000..3b664f436 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/static_init_aux.rs @@ -0,0 +1,10 @@ +pub static V: &u32 = &X; +pub static F: fn() = f; + +static X: u32 = 42; + +pub fn v() -> *const u32 { + V +} + +fn f() {} diff --git a/tests/ui/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs b/tests/ui/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs new file mode 100644 index 000000000..7c1175f7a --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs @@ -0,0 +1,3 @@ +pub trait FromBuf<'a> { + fn from_buf(_: &'a [u8]) -> Self; +} diff --git a/tests/ui/cross-crate/auxiliary/xcrate_address_insignificant.rs b/tests/ui/cross-crate/auxiliary/xcrate_address_insignificant.rs new file mode 100644 index 000000000..e79e334b5 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/xcrate_address_insignificant.rs @@ -0,0 +1,8 @@ +pub fn foo<T>() -> isize { + static a: isize = 3; + a +} + +pub fn bar() -> isize { + foo::<isize>() +} diff --git a/tests/ui/cross-crate/auxiliary/xcrate_associated_type_defaults.rs b/tests/ui/cross-crate/auxiliary/xcrate_associated_type_defaults.rs new file mode 100644 index 000000000..d8a55dd34 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/xcrate_associated_type_defaults.rs @@ -0,0 +1,12 @@ +#![feature(associated_type_defaults)] + +pub trait Foo<T: Default + ToString> { + type Out: Default + ToString = T; +} + +impl Foo<u32> for () { +} + +impl Foo<u64> for () { + type Out = bool; +} diff --git a/tests/ui/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs b/tests/ui/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs new file mode 100644 index 000000000..2ab23b4d7 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs @@ -0,0 +1,16 @@ +pub struct Request { + pub id: String, + pub arg: String, +} + +pub fn decode<T>() -> Result<Request, ()> { + (|| { + Ok(Request { + id: "hi".to_owned(), + arg: match Err(()) { + Ok(v) => v, + Err(e) => return Err(e) + }, + }) + })() +} diff --git a/tests/ui/cross-crate/auxiliary/xcrate_static_addresses.rs b/tests/ui/cross-crate/auxiliary/xcrate_static_addresses.rs new file mode 100644 index 000000000..e18d34799 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/xcrate_static_addresses.rs @@ -0,0 +1,17 @@ +pub static global: isize = 3; + +static global0: isize = 4; + +pub static global2: &'static isize = &global0; + +pub fn verify_same(a: &'static isize) { + let a = a as *const isize as usize; + let b = &global as *const isize as usize; + assert_eq!(a, b); +} + +pub fn verify_same2(a: &'static isize) { + let a = a as *const isize as usize; + let b = global2 as *const isize as usize; + assert_eq!(a, b); +} diff --git a/tests/ui/cross-crate/cci_borrow.rs b/tests/ui/cross-crate/cci_borrow.rs new file mode 100644 index 000000000..fee6b5d03 --- /dev/null +++ b/tests/ui/cross-crate/cci_borrow.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:cci_borrow_lib.rs + +extern crate cci_borrow_lib; +use cci_borrow_lib::foo; + +pub fn main() { + let p: Box<_> = Box::new(22); + let r = foo(&*p); + println!("r={}", r); + assert_eq!(r, 22); +} diff --git a/tests/ui/cross-crate/cci_capture_clause.rs b/tests/ui/cross-crate/cci_capture_clause.rs new file mode 100644 index 000000000..ea699b5f5 --- /dev/null +++ b/tests/ui/cross-crate/cci_capture_clause.rs @@ -0,0 +1,14 @@ +// run-pass +// aux-build:cci_capture_clause.rs + +// This test makes sure we can do cross-crate inlining on functions +// that use capture clauses. + +// pretty-expanded FIXME #23616 +// ignore-emscripten no threads support + +extern crate cci_capture_clause; + +pub fn main() { + cci_capture_clause::foo(()).recv().unwrap(); +} diff --git a/tests/ui/cross-crate/cci_impl_exe.rs b/tests/ui/cross-crate/cci_impl_exe.rs new file mode 100644 index 000000000..b11fb23eb --- /dev/null +++ b/tests/ui/cross-crate/cci_impl_exe.rs @@ -0,0 +1,18 @@ +// run-pass +// aux-build:cci_impl_lib.rs + +extern crate cci_impl_lib; +use cci_impl_lib::uint_helpers; + +pub fn main() { + //let bt0 = sys::frame_address(); + //println!("%?", bt0); + + 3.to(10, |i| { + println!("{}", i); + + //let bt1 = sys::frame_address(); + //println!("%?", bt1); + //assert_eq!(bt0, bt1); + }) +} diff --git a/tests/ui/cross-crate/cci_iter_exe.rs b/tests/ui/cross-crate/cci_iter_exe.rs new file mode 100644 index 000000000..8b58d90fe --- /dev/null +++ b/tests/ui/cross-crate/cci_iter_exe.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:cci_iter_lib.rs + +extern crate cci_iter_lib; + +pub fn main() { + //let bt0 = sys::rusti::frame_address(1); + //println!("%?", bt0); + cci_iter_lib::iter(&[1, 2, 3], |i| { + println!("{}", *i); + //assert_eq!(bt0, sys::rusti::frame_address(2)); + }) +} diff --git a/tests/ui/cross-crate/cci_nested_exe.rs b/tests/ui/cross-crate/cci_nested_exe.rs new file mode 100644 index 000000000..1c001a2a3 --- /dev/null +++ b/tests/ui/cross-crate/cci_nested_exe.rs @@ -0,0 +1,20 @@ +// run-pass +// aux-build:cci_nested_lib.rs + + +extern crate cci_nested_lib; +use cci_nested_lib::*; + +pub fn main() { + let lst = new_int_alist(); + alist_add(&lst, 22, "hi".to_string()); + alist_add(&lst, 44, "ho".to_string()); + assert_eq!(alist_get(&lst, 22), "hi".to_string()); + assert_eq!(alist_get(&lst, 44), "ho".to_string()); + + let lst = new_int_alist_2(); + alist_add(&lst, 22, "hi".to_string()); + alist_add(&lst, 44, "ho".to_string()); + assert_eq!(alist_get(&lst, 22), "hi".to_string()); + assert_eq!(alist_get(&lst, 44), "ho".to_string()); +} diff --git a/tests/ui/cross-crate/cci_no_inline_exe.rs b/tests/ui/cross-crate/cci_no_inline_exe.rs new file mode 100644 index 000000000..ffc701678 --- /dev/null +++ b/tests/ui/cross-crate/cci_no_inline_exe.rs @@ -0,0 +1,23 @@ +// run-pass +// aux-build:cci_no_inline_lib.rs + +extern crate cci_no_inline_lib; +use cci_no_inline_lib::iter; + +pub fn main() { + // Check that a cross-crate call function not marked as inline + // does not, in fact, get inlined. Also, perhaps more + // importantly, checks that our scheme of using + // sys::frame_address() to determine if we are inlining is + // actually working. + //let bt0 = sys::frame_address(); + //println!("%?", bt0); + iter(vec![1, 2, 3], |i| { + println!("{}", i); + + //let bt1 = sys::frame_address(); + //println!("%?", bt1); + + //assert!(bt0 != bt1); + }) +} diff --git a/tests/ui/cross-crate/const-cross-crate-const.rs b/tests/ui/cross-crate/const-cross-crate-const.rs new file mode 100644 index 000000000..92020417f --- /dev/null +++ b/tests/ui/cross-crate/const-cross-crate-const.rs @@ -0,0 +1,16 @@ +// run-pass +// aux-build:cci_const.rs +#![allow(non_upper_case_globals)] + +extern crate cci_const; +static foo: &'static str = cci_const::foopy; +static a: usize = cci_const::uint_val; +static b: usize = cci_const::uint_expr + 5; + +pub fn main() { + assert_eq!(a, 12); + let foo2 = a; + assert_eq!(foo2, cci_const::uint_val); + assert_eq!(b, cci_const::uint_expr + 5); + assert_eq!(foo, cci_const::foopy); +} diff --git a/tests/ui/cross-crate/const-cross-crate-extern.rs b/tests/ui/cross-crate/const-cross-crate-extern.rs new file mode 100644 index 000000000..3c61afd5b --- /dev/null +++ b/tests/ui/cross-crate/const-cross-crate-extern.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:cci_const.rs +#![allow(non_upper_case_globals)] + +extern crate cci_const; +use cci_const::bar; +static foo: extern "C" fn() = bar; + +pub fn main() { + assert!(foo == bar); +} diff --git a/tests/ui/cross-crate/cross-crate-const-pat.rs b/tests/ui/cross-crate/cross-crate-const-pat.rs new file mode 100644 index 000000000..e8fa8485a --- /dev/null +++ b/tests/ui/cross-crate/cross-crate-const-pat.rs @@ -0,0 +1,14 @@ +// run-pass +// aux-build:cci_const.rs + +// pretty-expanded FIXME #23616 + +extern crate cci_const; + +pub fn main() { + let x = cci_const::uint_val; + match x { + cci_const::uint_val => {} + _ => {} + } +} diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs b/tests/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs new file mode 100644 index 000000000..82bb95f1e --- /dev/null +++ b/tests/ui/cross-crate/issue-64872/auxiliary/a_def_obj.rs @@ -0,0 +1,16 @@ +// compile-flags: -C debuginfo=2 + +// no-prefer-dynamic +#![crate_type = "rlib"] + +pub trait Object { fn method(&self) { } } + +impl Object for u32 { } +impl Object for () { } +impl<T> Object for &T { } + +pub fn unused() { + let ref u = 0_u32; + let _d = &u as &dyn crate::Object; + _d.method() +} diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs b/tests/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs new file mode 100644 index 000000000..21c0274b9 --- /dev/null +++ b/tests/ui/cross-crate/issue-64872/auxiliary/b_reexport_obj.rs @@ -0,0 +1,7 @@ +// compile-flags: -C debuginfo=2 -C prefer-dynamic + +#![crate_type="dylib"] + +extern crate a_def_obj; + +pub use a_def_obj::Object; diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs b/tests/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs new file mode 100644 index 000000000..611238f56 --- /dev/null +++ b/tests/ui/cross-crate/issue-64872/auxiliary/c_another_vtable_for_obj.rs @@ -0,0 +1,12 @@ +// no-prefer-dynamic +// compile-flags: -C debuginfo=2 +#![crate_type="rlib"] + +extern crate b_reexport_obj; +use b_reexport_obj::Object; + +pub fn another_dyn_debug() { + let ref u = 1_u32; + let _d = &u as &dyn crate::Object; + _d.method() +} diff --git a/tests/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs b/tests/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs new file mode 100644 index 000000000..8d73f9b66 --- /dev/null +++ b/tests/ui/cross-crate/issue-64872/auxiliary/d_chain_of_rlibs_and_dylibs.rs @@ -0,0 +1,9 @@ +// compile-flags: -C debuginfo=2 -C prefer-dynamic + +#![crate_type="rlib"] + +extern crate c_another_vtable_for_obj; + +pub fn chain() { + c_another_vtable_for_obj::another_dyn_debug(); +} diff --git a/tests/ui/cross-crate/issue-64872/issue-64872.rs b/tests/ui/cross-crate/issue-64872/issue-64872.rs new file mode 100644 index 000000000..20fe2053c --- /dev/null +++ b/tests/ui/cross-crate/issue-64872/issue-64872.rs @@ -0,0 +1,17 @@ +// run-pass + +// note that these aux-build directives must be in this order: the +// later crates depend on the earlier ones. (The particular bug that +// is being exercised here used to exhibit itself during the build of +// `chain_of_rlibs_and_dylibs.dylib`) + +// aux-build:a_def_obj.rs +// aux-build:b_reexport_obj.rs +// aux-build:c_another_vtable_for_obj.rs +// aux-build:d_chain_of_rlibs_and_dylibs.rs + +extern crate d_chain_of_rlibs_and_dylibs; + +pub fn main() { + d_chain_of_rlibs_and_dylibs::chain(); +} diff --git a/tests/ui/cross-crate/moves-based-on-type-cross-crate.rs b/tests/ui/cross-crate/moves-based-on-type-cross-crate.rs new file mode 100644 index 000000000..3881e3352 --- /dev/null +++ b/tests/ui/cross-crate/moves-based-on-type-cross-crate.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:moves_based_on_type_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate moves_based_on_type_lib; +use moves_based_on_type_lib::f; + +pub fn main() { + f(); +} diff --git a/tests/ui/cross-crate/reexported-static-methods-cross-crate.rs b/tests/ui/cross-crate/reexported-static-methods-cross-crate.rs new file mode 100644 index 000000000..8c70a1ce4 --- /dev/null +++ b/tests/ui/cross-crate/reexported-static-methods-cross-crate.rs @@ -0,0 +1,16 @@ +// run-pass +// aux-build:reexported_static_methods.rs + +extern crate reexported_static_methods; + +use reexported_static_methods::Foo; +use reexported_static_methods::Baz; +use reexported_static_methods::Boz; +use reexported_static_methods::Bort; + +pub fn main() { + assert_eq!(42_isize, Foo::foo()); + assert_eq!(84_isize, Baz::bar()); + assert!(Boz::boz(1)); + assert_eq!("bort()".to_string(), Bort::bort()); +} diff --git a/tests/ui/cross-crate/static-array-across-crate.rs b/tests/ui/cross-crate/static-array-across-crate.rs new file mode 100644 index 000000000..0b84e0e6a --- /dev/null +++ b/tests/ui/cross-crate/static-array-across-crate.rs @@ -0,0 +1,13 @@ +// run-pass +#![allow(dead_code)] +// aux-build:pub_static_array.rs + +extern crate pub_static_array as array; + +use array::ARRAY; + +static X: &'static u8 = &ARRAY[0]; +static Y: &'static u8 = &(&ARRAY)[0]; +static Z: u8 = (&ARRAY)[0]; + +pub fn main() {} diff --git a/tests/ui/cross-crate/static-init.rs b/tests/ui/cross-crate/static-init.rs new file mode 100644 index 000000000..2e893c5d9 --- /dev/null +++ b/tests/ui/cross-crate/static-init.rs @@ -0,0 +1,15 @@ +// run-pass +// aux-build:static_init_aux.rs +extern crate static_init_aux as aux; + +static V: &u32 = aux::V; +static F: fn() = aux::F; + +fn v() -> *const u32 { + V +} + +fn main() { + assert_eq!(aux::v(), crate::v()); + F(); +} diff --git a/tests/ui/cross-crate/xcrate-address-insignificant.rs b/tests/ui/cross-crate/xcrate-address-insignificant.rs new file mode 100644 index 000000000..33c706506 --- /dev/null +++ b/tests/ui/cross-crate/xcrate-address-insignificant.rs @@ -0,0 +1,9 @@ +// run-pass +// aux-build:xcrate_address_insignificant.rs + + +extern crate xcrate_address_insignificant as foo; + +pub fn main() { + assert_eq!(foo::foo::<f64>(), foo::bar()); +} diff --git a/tests/ui/cross-crate/xcrate-associated-type-defaults.rs b/tests/ui/cross-crate/xcrate-associated-type-defaults.rs new file mode 100644 index 000000000..0f3e077d1 --- /dev/null +++ b/tests/ui/cross-crate/xcrate-associated-type-defaults.rs @@ -0,0 +1,29 @@ +// run-pass +// aux-build:xcrate_associated_type_defaults.rs + +extern crate xcrate_associated_type_defaults; +use xcrate_associated_type_defaults::Foo; + +struct LocalDefault; +impl Foo<u32> for LocalDefault {} + +struct LocalOverride; +impl Foo<u64> for LocalOverride { + type Out = bool; +} + +fn main() { + assert_eq!( + <() as Foo<u32>>::Out::default().to_string(), + "0"); + assert_eq!( + <() as Foo<u64>>::Out::default().to_string(), + "false"); + + assert_eq!( + <LocalDefault as Foo<u32>>::Out::default().to_string(), + "0"); + assert_eq!( + <LocalOverride as Foo<u64>>::Out::default().to_string(), + "false"); +} diff --git a/tests/ui/cross-crate/xcrate-static-addresses.rs b/tests/ui/cross-crate/xcrate-static-addresses.rs new file mode 100644 index 000000000..3c3397656 --- /dev/null +++ b/tests/ui/cross-crate/xcrate-static-addresses.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:xcrate_static_addresses.rs + +// pretty-expanded FIXME #23616 + +extern crate xcrate_static_addresses; + +use xcrate_static_addresses as other; + +pub fn main() { + other::verify_same(&other::global); + other::verify_same2(other::global2); +} diff --git a/tests/ui/cross-crate/xcrate-trait-lifetime-param.rs b/tests/ui/cross-crate/xcrate-trait-lifetime-param.rs new file mode 100644 index 000000000..1fd7eb878 --- /dev/null +++ b/tests/ui/cross-crate/xcrate-trait-lifetime-param.rs @@ -0,0 +1,19 @@ +// run-pass +#![allow(dead_code)] +// aux-build:xcrate-trait-lifetime-param.rs + +// pretty-expanded FIXME #23616 + +extern crate xcrate_trait_lifetime_param as other; + +struct Reader<'a> { + b : &'a [u8] +} + +impl <'a> other::FromBuf<'a> for Reader<'a> { + fn from_buf(b : &'a [u8]) -> Reader<'a> { + Reader { b : b } + } +} + +pub fn main () {} diff --git a/tests/ui/cross-crate/xcrate_generic_fn_nested_return.rs b/tests/ui/cross-crate/xcrate_generic_fn_nested_return.rs new file mode 100644 index 000000000..4593fec51 --- /dev/null +++ b/tests/ui/cross-crate/xcrate_generic_fn_nested_return.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:xcrate_generic_fn_nested_return.rs + +extern crate xcrate_generic_fn_nested_return as test; + +pub fn main() { + assert!(test::decode::<()>().is_err()); +} |