diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/issues | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/issues')
2122 files changed, 57413 insertions, 0 deletions
diff --git a/tests/ui/issues/auxiliary/cgu_test.rs b/tests/ui/issues/auxiliary/cgu_test.rs new file mode 100644 index 000000000..5ed973164 --- /dev/null +++ b/tests/ui/issues/auxiliary/cgu_test.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic +// compile-flags: --crate-type=lib + +pub fn id<T>(t: T) -> T { + t +} diff --git a/tests/ui/issues/auxiliary/cgu_test_a.rs b/tests/ui/issues/auxiliary/cgu_test_a.rs new file mode 100644 index 000000000..a3dcd9201 --- /dev/null +++ b/tests/ui/issues/auxiliary/cgu_test_a.rs @@ -0,0 +1,15 @@ +// no-prefer-dynamic +// compile-flags: -Ccodegen-units=2 --crate-type=lib + +extern crate cgu_test; + +pub mod a { + pub fn a() { + ::cgu_test::id(0); + } +} +pub mod b { + pub fn a() { + ::cgu_test::id(0); + } +} diff --git a/tests/ui/issues/auxiliary/cgu_test_b.rs b/tests/ui/issues/auxiliary/cgu_test_b.rs new file mode 100644 index 000000000..a3dcd9201 --- /dev/null +++ b/tests/ui/issues/auxiliary/cgu_test_b.rs @@ -0,0 +1,15 @@ +// no-prefer-dynamic +// compile-flags: -Ccodegen-units=2 --crate-type=lib + +extern crate cgu_test; + +pub mod a { + pub fn a() { + ::cgu_test::id(0); + } +} +pub mod b { + pub fn a() { + ::cgu_test::id(0); + } +} diff --git a/tests/ui/issues/auxiliary/i8.rs b/tests/ui/issues/auxiliary/i8.rs new file mode 100644 index 000000000..889a9c4eb --- /dev/null +++ b/tests/ui/issues/auxiliary/i8.rs @@ -0,0 +1,3 @@ +// A crate named after a built-in type. + +pub struct Test; diff --git a/tests/ui/issues/auxiliary/iss.rs b/tests/ui/issues/auxiliary/iss.rs new file mode 100644 index 000000000..cf32f6c2d --- /dev/null +++ b/tests/ui/issues/auxiliary/iss.rs @@ -0,0 +1,12 @@ +#![crate_name="issue6919_3"] + +// part of issue-6919.rs + +pub struct C<K> where K: FnOnce() { + pub k: K, +} + +fn no_op() { } +pub const D : C<fn()> = C { + k: no_op as fn() +}; diff --git a/tests/ui/issues/auxiliary/issue-11224.rs b/tests/ui/issues/auxiliary/issue-11224.rs new file mode 100644 index 000000000..63543621a --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-11224.rs @@ -0,0 +1,16 @@ +#![deny(dead_code)] + +mod inner { + pub trait Trait { + fn f(&self) { f(); } + } + + impl Trait for isize {} + + fn f() {} +} + +pub fn foo() { + let a = &1isize as &inner::Trait; + a.f(); +} diff --git a/tests/ui/issues/auxiliary/issue-11508.rs b/tests/ui/issues/auxiliary/issue-11508.rs new file mode 100644 index 000000000..16bfc65c2 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-11508.rs @@ -0,0 +1,10 @@ +pub struct Closed01<F>(pub F); + +pub trait Bar { fn new() -> Self; } + +impl<T: Bar> Bar for Closed01<T> { + fn new() -> Closed01<T> { Closed01(Bar::new()) } +} +impl Bar for f32 { fn new() -> f32 { 1.0 } } + +pub fn random<T: Bar>() -> T { Bar::new() } diff --git a/tests/ui/issues/auxiliary/issue-11529.rs b/tests/ui/issues/auxiliary/issue-11529.rs new file mode 100644 index 000000000..dd3ef4387 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-11529.rs @@ -0,0 +1 @@ +pub struct A<'a>(pub &'a isize); diff --git a/tests/ui/issues/auxiliary/issue-11680.rs b/tests/ui/issues/auxiliary/issue-11680.rs new file mode 100644 index 000000000..74abbf0bf --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-11680.rs @@ -0,0 +1,9 @@ +enum Foo { + Bar(isize) +} + +pub mod test { + enum Foo { + Bar(isize) + } +} diff --git a/tests/ui/issues/auxiliary/issue-12133-dylib.rs b/tests/ui/issues/auxiliary/issue-12133-dylib.rs new file mode 100644 index 000000000..8bd2b3353 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-12133-dylib.rs @@ -0,0 +1 @@ +#![crate_type = "dylib"] diff --git a/tests/ui/issues/auxiliary/issue-12133-dylib2.rs b/tests/ui/issues/auxiliary/issue-12133-dylib2.rs new file mode 100644 index 000000000..30de74006 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-12133-dylib2.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "dylib"] + +extern crate issue_12133_rlib as a; +extern crate issue_12133_dylib as b; diff --git a/tests/ui/issues/auxiliary/issue-12133-rlib.rs b/tests/ui/issues/auxiliary/issue-12133-rlib.rs new file mode 100644 index 000000000..39c261e11 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-12133-rlib.rs @@ -0,0 +1,3 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] diff --git a/tests/ui/issues/auxiliary/issue-12612-1.rs b/tests/ui/issues/auxiliary/issue-12612-1.rs new file mode 100644 index 000000000..01f5a784b --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-12612-1.rs @@ -0,0 +1,3 @@ +pub mod bar { + pub fn foo() {} +} diff --git a/tests/ui/issues/auxiliary/issue-12612-2.rs b/tests/ui/issues/auxiliary/issue-12612-2.rs new file mode 100644 index 000000000..2c7247871 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-12612-2.rs @@ -0,0 +1 @@ +pub fn baz() {} diff --git a/tests/ui/issues/auxiliary/issue-12660-aux.rs b/tests/ui/issues/auxiliary/issue-12660-aux.rs new file mode 100644 index 000000000..6dea8662d --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-12660-aux.rs @@ -0,0 +1,11 @@ +#![crate_type="lib"] +#![crate_name="issue12660aux"] + +pub use my_mod::{MyStruct, my_fn}; + +mod my_mod { + pub struct MyStruct; + + pub fn my_fn(my_struct: MyStruct) { + } +} diff --git a/tests/ui/issues/auxiliary/issue-13507.rs b/tests/ui/issues/auxiliary/issue-13507.rs new file mode 100644 index 000000000..c91013043 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-13507.rs @@ -0,0 +1,87 @@ +pub mod testtypes { + use std::any::TypeId; + + pub fn type_ids() -> Vec<TypeId> { + vec![ + TypeId::of::<FooBool>(), + TypeId::of::<FooInt>(), + TypeId::of::<FooUint>(), + TypeId::of::<FooFloat>(), + TypeId::of::<FooStr>(), + TypeId::of::<FooArray>(), + TypeId::of::<FooSlice>(), + TypeId::of::<FooBox>(), + TypeId::of::<FooPtr>(), + TypeId::of::<FooRef>(), + TypeId::of::<FooFnPtr>(), + TypeId::of::<FooNil>(), + TypeId::of::<FooTuple>(), + TypeId::of::<FooTrait>(), + TypeId::of::<FooStruct>(), + TypeId::of::<FooEnum>() + ] + } + + // Tests Bool + pub type FooBool = bool; + + // Tests Char + pub type FooChar = char; + + // Tests Int (does not test all variants of IntTy) + pub type FooInt = isize; + + // Tests Uint (does not test all variants of UintTy) + pub type FooUint = usize; + + // Tests Float (does not test all variants of FloatTy) + pub type FooFloat = f64; + + // Tests Str + pub type FooStr = str; + + // Tests Array + pub type FooArray = [u8; 1]; + + // Tests Slice + pub type FooSlice = [u8]; + + // Tests Box (of u8) + pub type FooBox = Box<u8>; + + // Tests RawPtr + pub type FooPtr = *const u8; + + // Tests Ref + pub type FooRef = &'static u8; + + // Tests FnPtr + pub type FooFnPtr = fn(u8) -> bool; + + // Tests Dynamic + pub trait FooTrait { + fn foo_method(&self) -> usize; + } + + // Tests struct + pub struct FooStruct { + pub pub_foo_field: usize, + foo_field: usize + } + + // Tests enum + pub enum FooEnum { + VarA(usize), + VarB(usize, usize) + } + + // Tests Tuple + pub type FooNil = (); + pub type FooTuple = (u8, i8, bool); + + // Skipping Param + + // Skipping Infer + + // Skipping Error +} diff --git a/tests/ui/issues/auxiliary/issue-13620-1.rs b/tests/ui/issues/auxiliary/issue-13620-1.rs new file mode 100644 index 000000000..a77aa5a71 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-13620-1.rs @@ -0,0 +1,9 @@ +pub struct Foo { + pub foo: extern "C" fn() +} + +extern "C" fn the_foo() {} + +pub const FOO: Foo = Foo { + foo: the_foo +}; diff --git a/tests/ui/issues/auxiliary/issue-13620-2.rs b/tests/ui/issues/auxiliary/issue-13620-2.rs new file mode 100644 index 000000000..7efd24407 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-13620-2.rs @@ -0,0 +1,3 @@ +extern crate issue_13620_1 as crate1; + +pub static FOO2: crate1::Foo = crate1::FOO; diff --git a/tests/ui/issues/auxiliary/issue-13872-1.rs b/tests/ui/issues/auxiliary/issue-13872-1.rs new file mode 100644 index 000000000..fa9258834 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-13872-1.rs @@ -0,0 +1 @@ +pub enum A { B } diff --git a/tests/ui/issues/auxiliary/issue-13872-2.rs b/tests/ui/issues/auxiliary/issue-13872-2.rs new file mode 100644 index 000000000..8c64f16e3 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-13872-2.rs @@ -0,0 +1,3 @@ +extern crate issue_13872_1 as foo; + +pub use foo::A::B; diff --git a/tests/ui/issues/auxiliary/issue-13872-3.rs b/tests/ui/issues/auxiliary/issue-13872-3.rs new file mode 100644 index 000000000..d31d52eb8 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-13872-3.rs @@ -0,0 +1,9 @@ +extern crate issue_13872_2 as bar; + +use bar::B; + +pub fn foo() { + match B { + B => {} + } +} diff --git a/tests/ui/issues/auxiliary/issue-14344-1.rs b/tests/ui/issues/auxiliary/issue-14344-1.rs new file mode 100644 index 000000000..954a1e554 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-14344-1.rs @@ -0,0 +1,5 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/ui/issues/auxiliary/issue-14344-2.rs b/tests/ui/issues/auxiliary/issue-14344-2.rs new file mode 100644 index 000000000..c47b8c0ea --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-14344-2.rs @@ -0,0 +1,3 @@ +extern crate issue_14344_1; + +pub fn bar() {} diff --git a/tests/ui/issues/auxiliary/issue-14421.rs b/tests/ui/issues/auxiliary/issue-14421.rs new file mode 100644 index 000000000..5fe4b24cf --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-14421.rs @@ -0,0 +1,25 @@ +#![crate_type="lib"] +#![deny(warnings)] +#![allow(dead_code)] + +pub use src::aliases::B; +pub use src::hidden_core::make; + +mod src { + pub mod aliases { + use super::hidden_core::A; + pub type B = A<f32>; + } + + pub mod hidden_core { + use super::aliases::B; + + pub struct A<T> { t: T } + + pub fn make() -> B { A { t: 1.0 } } + + impl<T> A<T> { + pub fn foo(&mut self) { println!("called foo"); } + } + } +} diff --git a/tests/ui/issues/auxiliary/issue-14422.rs b/tests/ui/issues/auxiliary/issue-14422.rs new file mode 100644 index 000000000..a6026c1d0 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-14422.rs @@ -0,0 +1,25 @@ +#![crate_type="lib"] +#![deny(warnings)] + +pub use src::aliases::B; +pub use src::hidden_core::make; + +mod src { + pub mod aliases { + use super::hidden_core::A; + pub type B = A; + } + + pub mod hidden_core { + use super::aliases::B; + + #[derive(Copy, Clone)] + pub struct A; + + pub fn make() -> B { A } + + impl A { + pub fn foo(&mut self) { println!("called foo"); } + } + } +} diff --git a/tests/ui/issues/auxiliary/issue-15562.rs b/tests/ui/issues/auxiliary/issue-15562.rs new file mode 100644 index 000000000..6ff26b47e --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-15562.rs @@ -0,0 +1,5 @@ +#![crate_type = "lib"] + +extern "C" { + pub fn transmute(); +} diff --git a/tests/ui/issues/auxiliary/issue-16643.rs b/tests/ui/issues/auxiliary/issue-16643.rs new file mode 100644 index 000000000..7808e0119 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-16643.rs @@ -0,0 +1,19 @@ +#![crate_type = "lib"] + +pub struct TreeBuilder<H> { pub h: H } + +impl<H> TreeBuilder<H> { + pub fn process_token(&mut self) { + match self { + _ => for _y in self.by_ref() {} + } + } +} + +impl<H> Iterator for TreeBuilder<H> { + type Item = H; + + fn next(&mut self) -> Option<H> { + None + } +} diff --git a/tests/ui/issues/auxiliary/issue-16725.rs b/tests/ui/issues/auxiliary/issue-16725.rs new file mode 100644 index 000000000..9f9abd575 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-16725.rs @@ -0,0 +1,3 @@ +extern "C" { + fn bar(); +} diff --git a/tests/ui/issues/auxiliary/issue-17662.rs b/tests/ui/issues/auxiliary/issue-17662.rs new file mode 100644 index 000000000..75efe110c --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-17662.rs @@ -0,0 +1,12 @@ +#![crate_type = "lib"] + +pub trait Foo<'a, T> { + fn foo(&'a self) -> T; +} + +pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T { + let x: &'a Foo<T> = x; + // ^ the lifetime parameter of Foo is left to be inferred. + x.foo() + // ^ encoding this method call in metadata triggers an ICE. +} diff --git a/tests/ui/issues/auxiliary/issue-18501.rs b/tests/ui/issues/auxiliary/issue-18501.rs new file mode 100644 index 000000000..dd914b464 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-18501.rs @@ -0,0 +1,17 @@ +#![crate_type = "rlib"] +struct Foo; + +trait Tr { + fn tr(&self); +} + +impl Tr for Foo { + fn tr(&self) {} +} + +fn take_method<T>(f: fn(&T), t: &T) {} + +#[inline] +pub fn pass_method() { + take_method(Tr::tr, &Foo); +} diff --git a/tests/ui/issues/auxiliary/issue-18514.rs b/tests/ui/issues/auxiliary/issue-18514.rs new file mode 100644 index 000000000..20c8e60ee --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-18514.rs @@ -0,0 +1,17 @@ +#![crate_type = "rlib"] + +pub trait Tr { + fn tr(&self); +} + +pub struct St<V>(pub Vec<V>); + +impl<V> Tr for St<V> { + fn tr(&self) { + match self { + &St(ref v) => { + v.iter(); + } + } + } +} diff --git a/tests/ui/issues/auxiliary/issue-18711.rs b/tests/ui/issues/auxiliary/issue-18711.rs new file mode 100644 index 000000000..5cb1f9c43 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-18711.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +pub fn inner<F>(f: F) -> F { + (move || f)() +} diff --git a/tests/ui/issues/auxiliary/issue-18913-1.rs b/tests/ui/issues/auxiliary/issue-18913-1.rs new file mode 100644 index 000000000..053c5ada5 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-18913-1.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![crate_name = "foo"] + +pub fn foo() -> i32 { 0 } diff --git a/tests/ui/issues/auxiliary/issue-18913-2.rs b/tests/ui/issues/auxiliary/issue-18913-2.rs new file mode 100644 index 000000000..54747b45f --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-18913-2.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![crate_name = "foo"] + +pub fn foo() -> i32 { 1 } diff --git a/tests/ui/issues/auxiliary/issue-1920.rs b/tests/ui/issues/auxiliary/issue-1920.rs new file mode 100644 index 000000000..1548cb995 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-1920.rs @@ -0,0 +1,4 @@ +// Just exporting some type to test for correct diagnostics when this +// crate is pulled in at a non-root location in client crate. + +pub struct S; diff --git a/tests/ui/issues/auxiliary/issue-19293.rs b/tests/ui/issues/auxiliary/issue-19293.rs new file mode 100644 index 000000000..31359e865 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-19293.rs @@ -0,0 +1,4 @@ +pub struct Foo (pub isize); +pub enum MyEnum { + Foo(Foo), +} diff --git a/tests/ui/issues/auxiliary/issue-19340-1.rs b/tests/ui/issues/auxiliary/issue-19340-1.rs new file mode 100644 index 000000000..39ee36b8b --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-19340-1.rs @@ -0,0 +1,3 @@ +pub enum Homura { + Madoka { name: String }, +} diff --git a/tests/ui/issues/auxiliary/issue-20389.rs b/tests/ui/issues/auxiliary/issue-20389.rs new file mode 100644 index 000000000..ae6d44eeb --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-20389.rs @@ -0,0 +1,4 @@ +pub trait T { + type C; + fn dummy(&self) { } +} diff --git a/tests/ui/issues/auxiliary/issue-21202.rs b/tests/ui/issues/auxiliary/issue-21202.rs new file mode 100644 index 000000000..e3daa1ba0 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-21202.rs @@ -0,0 +1,6 @@ +pub mod A { + pub struct Foo; + impl Foo { + fn foo(&self) { } + } +} diff --git a/tests/ui/issues/auxiliary/issue-2170-lib.rs b/tests/ui/issues/auxiliary/issue-2170-lib.rs new file mode 100644 index 000000000..a99385a83 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2170-lib.rs @@ -0,0 +1,18 @@ +fn foo(_x: i32) { +} + +pub struct rsrc { + x: i32, +} + +impl Drop for rsrc { + fn drop(&mut self) { + foo(self.x); + } +} + +pub fn rsrc(x: i32) -> rsrc { + rsrc { + x: x + } +} diff --git a/tests/ui/issues/auxiliary/issue-2316-a.rs b/tests/ui/issues/auxiliary/issue-2316-a.rs new file mode 100644 index 000000000..418ddc0b0 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2316-a.rs @@ -0,0 +1,3 @@ +enum cat { + tabby, calico, tortoiseshell +} diff --git a/tests/ui/issues/auxiliary/issue-2316-b.rs b/tests/ui/issues/auxiliary/issue-2316-b.rs new file mode 100644 index 000000000..550c2d6eb --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2316-b.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] + +extern crate issue_2316_a; + +pub mod cloth { + use issue_2316_a::*; + + pub enum fabric { + gingham, flannel, calico + } +} diff --git a/tests/ui/issues/auxiliary/issue-2380.rs b/tests/ui/issues/auxiliary/issue-2380.rs new file mode 100644 index 000000000..79fd62d16 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2380.rs @@ -0,0 +1,13 @@ +#![crate_name="a"] +#![crate_type = "lib"] + +pub trait i<T> +{ + fn dummy(&self, t: T) -> T { panic!() } +} + +pub fn f<T>() -> Box<i<T>+'static> { + impl<T> i<T> for () { } + + Box::new(()) as Box<i<T>+'static> +} diff --git a/tests/ui/issues/auxiliary/issue-2414-a.rs b/tests/ui/issues/auxiliary/issue-2414-a.rs new file mode 100644 index 000000000..b90ab32dd --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2414-a.rs @@ -0,0 +1,12 @@ +#![crate_name="a"] +#![crate_type = "lib"] + +type t1 = usize; + +trait foo { + fn foo(&self); +} + +impl foo for String { + fn foo(&self) {} +} diff --git a/tests/ui/issues/auxiliary/issue-2414-b.rs b/tests/ui/issues/auxiliary/issue-2414-b.rs new file mode 100644 index 000000000..fc018349d --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2414-b.rs @@ -0,0 +1,4 @@ +#![crate_name="b"] +#![crate_type = "lib"] + +extern crate a; diff --git a/tests/ui/issues/auxiliary/issue-2472-b.rs b/tests/ui/issues/auxiliary/issue-2472-b.rs new file mode 100644 index 000000000..0d151520f --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2472-b.rs @@ -0,0 +1,13 @@ +pub struct S(pub ()); + +impl S { + pub fn foo(&self) { } +} + +pub trait T { + fn bar(&self); +} + +impl T for S { + fn bar(&self) { } +} diff --git a/tests/ui/issues/auxiliary/issue-25185-1.rs b/tests/ui/issues/auxiliary/issue-25185-1.rs new file mode 100644 index 000000000..e957be9c1 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-25185-1.rs @@ -0,0 +1,8 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#[link(name = "rust_test_helpers", kind = "static")] +extern "C" { + pub fn rust_dbg_extern_identity_u32(u: u32) -> u32; +} diff --git a/tests/ui/issues/auxiliary/issue-25185-2.rs b/tests/ui/issues/auxiliary/issue-25185-2.rs new file mode 100644 index 000000000..7ce3df255 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-25185-2.rs @@ -0,0 +1,3 @@ +extern crate issue_25185_1; + +pub use issue_25185_1::rust_dbg_extern_identity_u32; diff --git a/tests/ui/issues/auxiliary/issue-2526.rs b/tests/ui/issues/auxiliary/issue-2526.rs new file mode 100644 index 000000000..3b27f658c --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2526.rs @@ -0,0 +1,44 @@ +#![crate_name="issue_2526"] +#![crate_type = "lib"] + +use std::marker; + +pub struct arc_destruct<T: Sync> { + _data: isize, + _marker: marker::PhantomData<T> +} + +impl<T: Sync> Drop for arc_destruct<T> { + fn drop(&mut self) {} +} + +fn arc_destruct<T: Sync>(data: isize) -> arc_destruct<T> { + arc_destruct { + _data: data, + _marker: marker::PhantomData + } +} + +fn arc<T: Sync>(_data: T) -> arc_destruct<T> { + arc_destruct(0) +} + +fn init() -> arc_destruct<context_res> { + arc(context_res()) +} + +pub struct context_res { + ctx : isize, +} + +impl Drop for context_res { + fn drop(&mut self) {} +} + +fn context_res() -> context_res { + context_res { + ctx: 0 + } +} + +pub type context = arc_destruct<context_res>; diff --git a/tests/ui/issues/auxiliary/issue-25467.rs b/tests/ui/issues/auxiliary/issue-25467.rs new file mode 100644 index 000000000..ca9b3097c --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-25467.rs @@ -0,0 +1,10 @@ +#![crate_type="lib"] + +pub trait Trait { + // the issue is sensitive to interning order - so use names + // unlikely to appear in libstd. + type Issue25467FooT; + type Issue25467BarT; +} + +pub type Object = Option<Box<Trait<Issue25467FooT=(),Issue25467BarT=()>>>; diff --git a/tests/ui/issues/auxiliary/issue-2631-a.rs b/tests/ui/issues/auxiliary/issue-2631-a.rs new file mode 100644 index 000000000..1e8211bfa --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2631-a.rs @@ -0,0 +1,14 @@ +#![crate_name="req"] +#![crate_type = "lib"] + +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; + +pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>; + +// the unused ty param is necessary so this gets monomorphized +pub fn request<T>(req: &header_map) { + let data = req[&"METHOD".to_string()].clone(); + let _x = data.borrow().clone()[0].clone(); +} diff --git a/tests/ui/issues/auxiliary/issue-2723-a.rs b/tests/ui/issues/auxiliary/issue-2723-a.rs new file mode 100644 index 000000000..661b46d82 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-2723-a.rs @@ -0,0 +1,3 @@ +pub unsafe fn f(xs: Vec<isize> ) { + xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>(); +} diff --git a/tests/ui/issues/auxiliary/issue-29181.rs b/tests/ui/issues/auxiliary/issue-29181.rs new file mode 100644 index 000000000..bd1a9be4e --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-29181.rs @@ -0,0 +1,5 @@ +#![crate_type="lib"] + +pub mod foo { + pub use super::*; +} diff --git a/tests/ui/issues/auxiliary/issue-29265.rs b/tests/ui/issues/auxiliary/issue-29265.rs new file mode 100644 index 000000000..6d26002a2 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-29265.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] + +pub struct SomeType { + pub some_member: usize, +} + +pub static SOME_VALUE: SomeType = SomeType { + some_member: 1, +}; diff --git a/tests/ui/issues/auxiliary/issue-29485.rs b/tests/ui/issues/auxiliary/issue-29485.rs new file mode 100644 index 000000000..1e8891c51 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-29485.rs @@ -0,0 +1,16 @@ +#![crate_name="a"] +#![crate_type = "lib"] + +pub struct X(pub u8); + +impl Drop for X { + fn drop(&mut self) { + assert_eq!(self.0, 1) + } +} + +pub fn f(x: &mut X, g: fn()) { + x.0 = 1; + g(); + x.0 = 0; +} diff --git a/tests/ui/issues/auxiliary/issue-3012-1.rs b/tests/ui/issues/auxiliary/issue-3012-1.rs new file mode 100644 index 000000000..509af2a8d --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-3012-1.rs @@ -0,0 +1,20 @@ +#![crate_name="socketlib"] +#![crate_type = "lib"] + +pub mod socket { + pub struct socket_handle { + sockfd: u32, + } + + impl Drop for socket_handle { + fn drop(&mut self) { + /* c::close(self.sockfd); */ + } + } + + pub fn socket_handle(x: u32) -> socket_handle { + socket_handle { + sockfd: x + } + } +} diff --git a/tests/ui/issues/auxiliary/issue-30123-aux.rs b/tests/ui/issues/auxiliary/issue-30123-aux.rs new file mode 100644 index 000000000..07c743eb2 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-30123-aux.rs @@ -0,0 +1,23 @@ +use std::marker::PhantomData; + +pub struct Directed; +pub struct Undirected; + +pub struct Graph<N, E, Ty = Directed> { + nodes: Vec<PhantomData<N>>, + edges: Vec<PhantomData<E>>, + ty: PhantomData<Ty>, +} + + +impl<N, E> Graph<N, E, Directed> { + pub fn new() -> Self { + Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData} + } +} + +impl<N, E> Graph<N, E, Undirected> { + pub fn new_undirected() -> Self { + Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData} + } +} diff --git a/tests/ui/issues/auxiliary/issue-3136-a.rc b/tests/ui/issues/auxiliary/issue-3136-a.rc new file mode 100644 index 000000000..cd5fd3145 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-3136-a.rc @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +#[path = "issue-3136-a.rs"] +pub mod issue_3136_a; diff --git a/tests/ui/issues/auxiliary/issue-3136-a.rs b/tests/ui/issues/auxiliary/issue-3136-a.rs new file mode 100644 index 000000000..9bb546ab3 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-3136-a.rs @@ -0,0 +1,14 @@ +trait x { + fn use_x<T>(&self); +} +struct y(()); +impl x for y { + fn use_x<T>(&self) { + struct foo { //~ ERROR quux + i: () + } + fn new_foo<T>(i: ()) -> foo { + foo { i: i } + } + } +} diff --git a/tests/ui/issues/auxiliary/issue-31702-1.rs b/tests/ui/issues/auxiliary/issue-31702-1.rs new file mode 100644 index 000000000..a48d0dc2c --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-31702-1.rs @@ -0,0 +1,16 @@ +#[derive(Copy)] +pub struct U256(pub [u64; 4]); + +impl Clone for U256 { + fn clone(&self) -> U256 { + *self + } +} + +impl U256 { + pub fn new(value: u64) -> U256 { + let mut ret = [0; 4]; + ret[0] = value; + U256(ret) + } +} diff --git a/tests/ui/issues/auxiliary/issue-31702-2.rs b/tests/ui/issues/auxiliary/issue-31702-2.rs new file mode 100644 index 000000000..d360ae0ca --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-31702-2.rs @@ -0,0 +1,20 @@ +// compile-flags: -g + +extern crate issue_31702_1; + +use std::collections::HashMap; +use issue_31702_1::U256; + +pub struct Ethash { + engine_params: fn() -> Option<&'static Vec<u8>>, + u256_params: HashMap<String, U256>, +} + +impl Ethash { + pub fn u256_param(&mut self, name: &str) -> U256 { + let engine = self.engine_params; + *self.u256_params.entry(name.to_owned()).or_insert_with(|| { + engine().map_or(U256::new(0u64), |_a| loop {}) + }) + } +} diff --git a/tests/ui/issues/auxiliary/issue-34796-aux.rs b/tests/ui/issues/auxiliary/issue-34796-aux.rs new file mode 100644 index 000000000..09c69b903 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-34796-aux.rs @@ -0,0 +1,20 @@ +#![crate_type = "lib"] +pub trait Future { + type Item; + type Error; +} + +impl Future for u32 { + type Item = (); + type Error = Box<()>; +} + +fn foo() -> Box<Future<Item=(), Error=Box<()>>> { + Box::new(0u32) +} + +pub fn bar<F, A, B>(_s: F) + where F: Fn(A) -> B, +{ + foo(); +} diff --git a/tests/ui/issues/auxiliary/issue-36954.rs b/tests/ui/issues/auxiliary/issue-36954.rs new file mode 100644 index 000000000..bc444a381 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-36954.rs @@ -0,0 +1,7 @@ +#![crate_type = "lib"] + +const fn foo(i: i32) -> i32 { + i +} + +pub const FOO: i32 = foo(1); diff --git a/tests/ui/issues/auxiliary/issue-38190.rs b/tests/ui/issues/auxiliary/issue-38190.rs new file mode 100644 index 000000000..373e646ba --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-38190.rs @@ -0,0 +1,2 @@ +#[macro_export] +macro_rules! m { ([$i:item]) => {} } diff --git a/tests/ui/issues/auxiliary/issue-38226-aux.rs b/tests/ui/issues/auxiliary/issue-38226-aux.rs new file mode 100644 index 000000000..f96801719 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-38226-aux.rs @@ -0,0 +1,23 @@ +#![crate_type="rlib"] + +#[inline(never)] +pub fn foo<T>() { + let _: Box<SomeTrait> = Box::new(SomeTraitImpl); +} + +pub fn bar() { + SomeTraitImpl.bar(); +} + +mod submod { + pub trait SomeTrait { + fn bar(&self) { + panic!("NO") + } + } +} + +use self::submod::SomeTrait; + +pub struct SomeTraitImpl; +impl SomeTrait for SomeTraitImpl {} diff --git a/tests/ui/issues/auxiliary/issue-3979-traits.rs b/tests/ui/issues/auxiliary/issue-3979-traits.rs new file mode 100644 index 000000000..5d03a0e9e --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-3979-traits.rs @@ -0,0 +1,15 @@ +#![crate_name="issue_3979_traits"] + +#![crate_type = "lib"] + +pub trait Positioned { + fn SetX(&mut self, _: isize); + fn X(&self) -> isize; +} + +pub trait Movable: Positioned { + fn translate(&mut self, dx: isize) { + let x = self.X() + dx; + self.SetX(x); + } +} diff --git a/tests/ui/issues/auxiliary/issue-41053.rs b/tests/ui/issues/auxiliary/issue-41053.rs new file mode 100644 index 000000000..ae73c3e78 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-41053.rs @@ -0,0 +1 @@ +pub struct Test; diff --git a/tests/ui/issues/auxiliary/issue-41394.rs b/tests/ui/issues/auxiliary/issue-41394.rs new file mode 100644 index 000000000..2e650efc7 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-41394.rs @@ -0,0 +1,16 @@ +#![crate_type = "lib"] + +#[repr(u32)] +pub enum Foo { + Foo = Private::Variant as u32 +} + +#[repr(u8)] +enum Private { + Variant = 42 +} + +#[inline(always)] +pub fn foo() -> Foo { + Foo::Foo +} diff --git a/tests/ui/issues/auxiliary/issue-41549.rs b/tests/ui/issues/auxiliary/issue-41549.rs new file mode 100644 index 000000000..b7bd37525 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-41549.rs @@ -0,0 +1,3 @@ +pub trait Trait { + const CONST: u32; +} diff --git a/tests/ui/issues/auxiliary/issue-42007-s.rs b/tests/ui/issues/auxiliary/issue-42007-s.rs new file mode 100644 index 000000000..95119a589 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-42007-s.rs @@ -0,0 +1,4 @@ +#[repr(u8)] +pub enum E { + B = 1 as u8, +} diff --git a/tests/ui/issues/auxiliary/issue-4208-cc.rs b/tests/ui/issues/auxiliary/issue-4208-cc.rs new file mode 100644 index 000000000..7b4c8b01a --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-4208-cc.rs @@ -0,0 +1,10 @@ +#![crate_name="numeric"] +#![crate_type = "lib"] + +pub trait Trig<T> { + fn sin(&self) -> T; +} + +pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() } + +pub trait Angle<T>: Trig<T> {} diff --git a/tests/ui/issues/auxiliary/issue-4545.rs b/tests/ui/issues/auxiliary/issue-4545.rs new file mode 100644 index 000000000..2f6094750 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-4545.rs @@ -0,0 +1,2 @@ +pub struct S<T>(Option<T>); +pub fn mk<T>() -> S<T> { S(None) } diff --git a/tests/ui/issues/auxiliary/issue-48984-aux.rs b/tests/ui/issues/auxiliary/issue-48984-aux.rs new file mode 100644 index 000000000..7cc888cd4 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-48984-aux.rs @@ -0,0 +1,6 @@ +#![crate_type = "lib"] +#![crate_name = "issue48984aux"] + +pub trait Foo { type Item; } + +pub trait Bar: Foo<Item=[u8;1]> { } diff --git a/tests/ui/issues/auxiliary/issue-49544.rs b/tests/ui/issues/auxiliary/issue-49544.rs new file mode 100644 index 000000000..f8b3a3fba --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-49544.rs @@ -0,0 +1,7 @@ +#![crate_type = "lib"] + +pub fn foo() -> Vec<String> { + std::env::args() + .skip(1) + .collect() +} diff --git a/tests/ui/issues/auxiliary/issue-51798.rs b/tests/ui/issues/auxiliary/issue-51798.rs new file mode 100644 index 000000000..fef5213db --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-51798.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub fn vec() -> Vec<u8> { vec![] } diff --git a/tests/ui/issues/auxiliary/issue-52489.rs b/tests/ui/issues/auxiliary/issue-52489.rs new file mode 100644 index 000000000..f53bf7db5 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-52489.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] +#![unstable(feature = "issue_52489_unstable", issue = "none")] +#![feature(staged_api)] diff --git a/tests/ui/issues/auxiliary/issue-5518.rs b/tests/ui/issues/auxiliary/issue-5518.rs new file mode 100644 index 000000000..bfe96552a --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-5518.rs @@ -0,0 +1,4 @@ +trait A<'a, T> { + fn f(&mut self) -> &'a mut T; + fn p() -> T; +} diff --git a/tests/ui/issues/auxiliary/issue-5521.rs b/tests/ui/issues/auxiliary/issue-5521.rs new file mode 100644 index 000000000..c2f81779b --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-5521.rs @@ -0,0 +1,3 @@ +use std::collections::HashMap; + +pub type map = Box<HashMap<usize, usize>>; diff --git a/tests/ui/issues/auxiliary/issue-56943.rs b/tests/ui/issues/auxiliary/issue-56943.rs new file mode 100644 index 000000000..65b9beb91 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-56943.rs @@ -0,0 +1,3 @@ +pub struct S; +mod m { pub struct S; } +pub use crate::m::S as S2; diff --git a/tests/ui/issues/auxiliary/issue-57271-lib.rs b/tests/ui/issues/auxiliary/issue-57271-lib.rs new file mode 100644 index 000000000..ff625668a --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-57271-lib.rs @@ -0,0 +1,11 @@ +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub enum BaseType { + Byte, + Char, + Double, + Float, + Int, + Long, + Short, + Boolean, +} diff --git a/tests/ui/issues/auxiliary/issue-5844-aux.rs b/tests/ui/issues/auxiliary/issue-5844-aux.rs new file mode 100644 index 000000000..ea83378ca --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-5844-aux.rs @@ -0,0 +1,3 @@ +extern "C" { + pub fn rand() -> u32; +} diff --git a/tests/ui/issues/auxiliary/issue-7178.rs b/tests/ui/issues/auxiliary/issue-7178.rs new file mode 100644 index 000000000..56ae5139a --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-7178.rs @@ -0,0 +1,7 @@ +pub struct Foo<'a, A:'a>(&'a A); + +impl<'a, A> Foo<'a, A> { + pub fn new(a: &'a A) -> Foo<'a, A> { + Foo(a) + } +} diff --git a/tests/ui/issues/auxiliary/issue-73112.rs b/tests/ui/issues/auxiliary/issue-73112.rs new file mode 100644 index 000000000..6210c29bb --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-73112.rs @@ -0,0 +1,10 @@ +#[repr(transparent)] +pub struct PageTableEntry { + entry: u64, +} + +#[repr(align(4096))] +#[repr(C)] +pub struct PageTable { + entries: [PageTableEntry; 512], +} diff --git a/tests/ui/issues/auxiliary/issue-7899.rs b/tests/ui/issues/auxiliary/issue-7899.rs new file mode 100644 index 000000000..3af6e8716 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-7899.rs @@ -0,0 +1 @@ +pub struct V2<T>(pub T, pub T); diff --git a/tests/ui/issues/auxiliary/issue-8044.rs b/tests/ui/issues/auxiliary/issue-8044.rs new file mode 100644 index 000000000..2ec25f51c --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-8044.rs @@ -0,0 +1,15 @@ +pub struct BTree<V> { + pub node: TreeItem<V>, +} + +pub enum TreeItem<V> { + TreeLeaf { value: V }, +} + +pub fn leaf<V>(value: V) -> TreeItem<V> { + TreeItem::TreeLeaf { value: value } +} + +fn main() { + BTree::<isize> { node: leaf(1) }; +} diff --git a/tests/ui/issues/auxiliary/issue-8259.rs b/tests/ui/issues/auxiliary/issue-8259.rs new file mode 100644 index 000000000..891aee099 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-8259.rs @@ -0,0 +1,4 @@ +pub enum Foo<'a> { + A, + B(&'a str), +} diff --git a/tests/ui/issues/auxiliary/issue-8401.rs b/tests/ui/issues/auxiliary/issue-8401.rs new file mode 100644 index 000000000..e35dbbfab --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-8401.rs @@ -0,0 +1,16 @@ +// for this issue, this code must be built in a library + +use std::mem; + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +fn bar<T>(_: &mut A, _: &T) {} + +fn foo<T>(t: &T) { + let mut b = B; + bar(&mut b as &mut A, t) +} diff --git a/tests/ui/issues/auxiliary/issue-9123.rs b/tests/ui/issues/auxiliary/issue-9123.rs new file mode 100644 index 000000000..60af53359 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-9123.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] + +pub trait X { + fn x() { + fn f() { } + f(); + } + fn dummy(&self) { } +} diff --git a/tests/ui/issues/auxiliary/issue-9155.rs b/tests/ui/issues/auxiliary/issue-9155.rs new file mode 100644 index 000000000..049a96a65 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-9155.rs @@ -0,0 +1,7 @@ +pub struct Foo<T>(T); + +impl<T> Foo<T> { + pub fn new(t: T) -> Foo<T> { + Foo(t) + } +} diff --git a/tests/ui/issues/auxiliary/issue-9188.rs b/tests/ui/issues/auxiliary/issue-9188.rs new file mode 100644 index 000000000..3bc5697a1 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-9188.rs @@ -0,0 +1,13 @@ +pub fn foo<T>() -> &'static isize { + if false { + static a: isize = 4; + return &a; + } else { + static a: isize = 5; + return &a; + } +} + +pub fn bar() -> &'static isize { + foo::<isize>() +} diff --git a/tests/ui/issues/auxiliary/issue-9906.rs b/tests/ui/issues/auxiliary/issue-9906.rs new file mode 100644 index 000000000..8a3eea790 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-9906.rs @@ -0,0 +1,15 @@ +pub use other::FooBar; +pub use other::foo; + +mod other { + pub struct FooBar{value: isize} + impl FooBar{ + pub fn new(val: isize) -> FooBar { + FooBar{value: val} + } + } + + pub fn foo(){ + 1+1; + } +} diff --git a/tests/ui/issues/auxiliary/issue-9968.rs b/tests/ui/issues/auxiliary/issue-9968.rs new file mode 100644 index 000000000..8d795b59e --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-9968.rs @@ -0,0 +1,22 @@ +pub use internal::core::{Trait, Struct}; + +mod internal { + pub mod core { + pub struct Struct; + impl Struct { + pub fn init() -> Struct { + Struct + } + } + + pub trait Trait { + fn test(&self) { + private(); + } + } + + impl Trait for Struct {} + + fn private() { } + } +} diff --git a/tests/ui/issues/auxiliary/private-trait-xc.rs b/tests/ui/issues/auxiliary/private-trait-xc.rs new file mode 100644 index 000000000..481a48a7c --- /dev/null +++ b/tests/ui/issues/auxiliary/private-trait-xc.rs @@ -0,0 +1 @@ +trait Foo {} diff --git a/tests/ui/issues/auxiliary/reexported-trait.rs b/tests/ui/issues/auxiliary/reexported-trait.rs new file mode 100644 index 000000000..51a991bef --- /dev/null +++ b/tests/ui/issues/auxiliary/reexported-trait.rs @@ -0,0 +1,17 @@ +mod private { + pub trait Trait { + fn trait_method(&self) { + } + } + pub trait TraitB { + fn trait_method_b(&self) { + } + } +} + +pub struct FooStruct; +pub use crate::private::Trait; +impl crate::private::Trait for FooStruct {} + +pub use crate::private::TraitB as TraitBRename; +impl crate::private::TraitB for FooStruct {} diff --git a/tests/ui/issues/issue-100605.rs b/tests/ui/issues/issue-100605.rs new file mode 100644 index 000000000..917a45c15 --- /dev/null +++ b/tests/ui/issues/issue-100605.rs @@ -0,0 +1,9 @@ +fn takes_option(_arg: Option<&String>) {} + +fn main() { + takes_option(&None); //~ ERROR 4:18: 4:23: mismatched types [E0308] + + let x = String::from("x"); + let res = Some(x); + takes_option(&res); //~ ERROR 8:18: 8:22: mismatched types [E0308] +} diff --git a/tests/ui/issues/issue-100605.stderr b/tests/ui/issues/issue-100605.stderr new file mode 100644 index 000000000..886e3cd6b --- /dev/null +++ b/tests/ui/issues/issue-100605.stderr @@ -0,0 +1,46 @@ +error[E0308]: mismatched types + --> $DIR/issue-100605.rs:4:18 + | +LL | takes_option(&None); + | ------------ ^^^^^ expected enum `Option`, found `&Option<_>` + | | + | arguments to this function are incorrect + | + = note: expected enum `Option<&String>` + found reference `&Option<_>` +note: function defined here + --> $DIR/issue-100605.rs:1:4 + | +LL | fn takes_option(_arg: Option<&String>) {} + | ^^^^^^^^^^^^ --------------------- +help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()` + | +LL | takes_option(None.as_ref()); + | ~~~~~~~~~~~~~ +help: consider removing the borrow + | +LL - takes_option(&None); +LL + takes_option(None); + | + +error[E0308]: mismatched types + --> $DIR/issue-100605.rs:8:18 + | +LL | takes_option(&res); + | ------------ ^^^^ + | | | + | | expected enum `Option`, found `&Option<String>` + | | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `res.as_ref()` + | arguments to this function are incorrect + | + = note: expected enum `Option<&String>` + found reference `&Option<String>` +note: function defined here + --> $DIR/issue-100605.rs:1:4 + | +LL | fn takes_option(_arg: Option<&String>) {} + | ^^^^^^^^^^^^ --------------------- + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-10228.rs b/tests/ui/issues/issue-10228.rs new file mode 100644 index 000000000..ebf8b436f --- /dev/null +++ b/tests/ui/issues/issue-10228.rs @@ -0,0 +1,20 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +enum StdioContainer { + CreatePipe(bool) +} + +struct Test<'a> { + args: &'a [String], + io: &'a [StdioContainer] +} + +pub fn main() { + let test = Test { + args: &[], + io: &[StdioContainer::CreatePipe(true)] + }; +} diff --git a/tests/ui/issues/issue-10291.rs b/tests/ui/issues/issue-10291.rs new file mode 100644 index 000000000..31b9e1240 --- /dev/null +++ b/tests/ui/issues/issue-10291.rs @@ -0,0 +1,8 @@ +fn test<'x>(x: &'x isize) { + drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + x + //~^ ERROR lifetime may not live long enough + })); +} + +fn main() {} diff --git a/tests/ui/issues/issue-10291.stderr b/tests/ui/issues/issue-10291.stderr new file mode 100644 index 000000000..a7b827d27 --- /dev/null +++ b/tests/ui/issues/issue-10291.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-10291.rs:3:9 + | +LL | fn test<'x>(x: &'x isize) { + | -- lifetime `'x` defined here +LL | drop::<Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { +LL | x + | ^ returning this value requires that `'x` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-102964.rs b/tests/ui/issues/issue-102964.rs new file mode 100644 index 000000000..43ff23600 --- /dev/null +++ b/tests/ui/issues/issue-102964.rs @@ -0,0 +1,10 @@ +use std::rc::Rc; +type Foo<'a, T> = &'a dyn Fn(&T); +type RcFoo<'a, T> = Rc<Foo<'a, T>>; + +fn bar_function<T>(function: Foo<T>) -> RcFoo<T> { + //~^ ERROR mismatched types + let rc = Rc::new(function); +} + +fn main() {} diff --git a/tests/ui/issues/issue-102964.stderr b/tests/ui/issues/issue-102964.stderr new file mode 100644 index 000000000..450403909 --- /dev/null +++ b/tests/ui/issues/issue-102964.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-102964.rs:5:41 + | +LL | fn bar_function<T>(function: Foo<T>) -> RcFoo<T> { + | ------------ ^^^^^^^^ expected struct `Rc`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | + = note: expected struct `Rc<&dyn for<'a> Fn(&'a T)>` + found unit type `()` +help: consider returning the local binding `rc` + | +LL ~ let rc = Rc::new(function); +LL + rc + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-10396.rs b/tests/ui/issues/issue-10396.rs new file mode 100644 index 000000000..d16ea3dc3 --- /dev/null +++ b/tests/ui/issues/issue-10396.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +#[derive(Debug)] +enum Foo<'s> { + V(&'s str) +} + +fn f(arr: &[&Foo]) { + for &f in arr { + println!("{:?}", f); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-10412.rs b/tests/ui/issues/issue-10412.rs new file mode 100644 index 000000000..0de170161 --- /dev/null +++ b/tests/ui/issues/issue-10412.rs @@ -0,0 +1,27 @@ +trait Serializable<'self, T> { + //~^ ERROR lifetimes cannot use keyword names + fn serialize(val: &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names + fn deserialize(repr: &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names +} + +impl<'self> Serializable<str> for &'self str { + //~^ ERROR lifetimes cannot use keyword names + //~| ERROR lifetimes cannot use keyword names + //~| ERROR implicit elided lifetime not allowed here + //~| ERROR the size for values of type `str` cannot be known at compilation time [E0277] + fn serialize(val: &'self str) -> Vec<u8> { + //~^ ERROR lifetimes cannot use keyword names + vec![1] + } + fn deserialize(repr: &[u8]) -> &'self str { + //~^ ERROR lifetimes cannot use keyword names + "hi" + } +} + +fn main() { + println!("hello"); + let x = "foo".to_string(); + let y = x; + println!("{}", y); +} diff --git a/tests/ui/issues/issue-10412.stderr b/tests/ui/issues/issue-10412.stderr new file mode 100644 index 000000000..46b9fd541 --- /dev/null +++ b/tests/ui/issues/issue-10412.stderr @@ -0,0 +1,75 @@ +error: lifetimes cannot use keyword names + --> $DIR/issue-10412.rs:1:20 + | +LL | trait Serializable<'self, T> { + | ^^^^^ + +error: lifetimes cannot use keyword names + --> $DIR/issue-10412.rs:3:24 + | +LL | fn serialize(val: &'self T) -> Vec<u8>; + | ^^^^^ + +error: lifetimes cannot use keyword names + --> $DIR/issue-10412.rs:4:37 + | +LL | fn deserialize(repr: &[u8]) -> &'self T; + | ^^^^^ + +error: lifetimes cannot use keyword names + --> $DIR/issue-10412.rs:7:6 + | +LL | impl<'self> Serializable<str> for &'self str { + | ^^^^^ + +error: lifetimes cannot use keyword names + --> $DIR/issue-10412.rs:7:36 + | +LL | impl<'self> Serializable<str> for &'self str { + | ^^^^^ + +error: lifetimes cannot use keyword names + --> $DIR/issue-10412.rs:12:24 + | +LL | fn serialize(val: &'self str) -> Vec<u8> { + | ^^^^^ + +error: lifetimes cannot use keyword names + --> $DIR/issue-10412.rs:16:37 + | +LL | fn deserialize(repr: &[u8]) -> &'self str { + | ^^^^^ + +error[E0726]: implicit elided lifetime not allowed here + --> $DIR/issue-10412.rs:7:13 + | +LL | impl<'self> Serializable<str> for &'self str { + | ^^^^^^^^^^^^^^^^^ expected lifetime parameter + | + = note: assuming a `'static` lifetime... +help: indicate the anonymous lifetime + | +LL | impl<'self> Serializable<'_, str> for &'self str { + | +++ + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/issue-10412.rs:7:13 + | +LL | impl<'self> Serializable<str> for &'self str { + | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` +note: required by a bound in `Serializable` + --> $DIR/issue-10412.rs:1:27 + | +LL | trait Serializable<'self, T> { + | ^ required by this bound in `Serializable` +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Serializable<'self, T: ?Sized> { + | ++++++++ + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0277, E0726. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-10436.rs b/tests/ui/issues/issue-10436.rs new file mode 100644 index 000000000..a7a20bad5 --- /dev/null +++ b/tests/ui/issues/issue-10436.rs @@ -0,0 +1,11 @@ +// run-pass +fn works<T>(x: T) -> Vec<T> { vec![x] } + +fn also_works<T: Clone>(x: T) -> Vec<T> { vec![x] } + +fn main() { + let _: Vec<usize> = works(0); + let _: Vec<usize> = also_works(0); + let _ = works(0); + let _ = also_works(0); +} diff --git a/tests/ui/issues/issue-10456.rs b/tests/ui/issues/issue-10456.rs new file mode 100644 index 000000000..9f8d25955 --- /dev/null +++ b/tests/ui/issues/issue-10456.rs @@ -0,0 +1,25 @@ +// check-pass +// pretty-expanded FIXME #23616 + +pub struct Foo; + +pub trait Bar { + fn bar(&self); +} + +pub trait Baz { + fn baz(&self) { } +} + +impl<T: Baz> Bar for T { + fn bar(&self) {} +} + +impl Baz for Foo {} + +pub fn foo(t: Box<Foo>) { + t.bar(); // ~Foo doesn't implement Baz + (*t).bar(); // ok b/c Foo implements Baz +} + +fn main() {} diff --git a/tests/ui/issues/issue-10465.rs b/tests/ui/issues/issue-10465.rs new file mode 100644 index 000000000..d899c3ffa --- /dev/null +++ b/tests/ui/issues/issue-10465.rs @@ -0,0 +1,23 @@ +pub mod a { + pub trait A { + fn foo(&self); + } + +} +pub mod b { + use a::A; + + pub struct B; + impl A for B { fn foo(&self) {} } + + pub mod c { + use b::B; + + fn foo(b: &B) { + b.foo(); //~ ERROR: no method named `foo` found + } + } + +} + +fn main() {} diff --git a/tests/ui/issues/issue-10465.stderr b/tests/ui/issues/issue-10465.stderr new file mode 100644 index 000000000..0ccf69dc0 --- /dev/null +++ b/tests/ui/issues/issue-10465.stderr @@ -0,0 +1,15 @@ +error[E0599]: no method named `foo` found for reference `&B` in the current scope + --> $DIR/issue-10465.rs:17:15 + | +LL | b.foo(); + | ^^^ method not found in `&B` + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use a::A; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-10545.rs b/tests/ui/issues/issue-10545.rs new file mode 100644 index 000000000..acd071496 --- /dev/null +++ b/tests/ui/issues/issue-10545.rs @@ -0,0 +1,9 @@ +mod a { + struct S; + impl S { } +} + +fn foo(_: a::S) { //~ ERROR: struct `S` is private +} + +fn main() {} diff --git a/tests/ui/issues/issue-10545.stderr b/tests/ui/issues/issue-10545.stderr new file mode 100644 index 000000000..f1da33eab --- /dev/null +++ b/tests/ui/issues/issue-10545.stderr @@ -0,0 +1,15 @@ +error[E0603]: struct `S` is private + --> $DIR/issue-10545.rs:6:14 + | +LL | fn foo(_: a::S) { + | ^ private struct + | +note: the struct `S` is defined here + --> $DIR/issue-10545.rs:2:5 + | +LL | struct S; + | ^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/issues/issue-10638.rs b/tests/ui/issues/issue-10638.rs new file mode 100644 index 000000000..e359669c0 --- /dev/null +++ b/tests/ui/issues/issue-10638.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + //// I am not a doc comment! + ////////////////// still not a doc comment + /////**** nope, me neither */ + /*** And neither am I! */ + 5; + /*****! certainly not I */ +} diff --git a/tests/ui/issues/issue-10656.rs b/tests/ui/issues/issue-10656.rs new file mode 100644 index 000000000..250c4bc44 --- /dev/null +++ b/tests/ui/issues/issue-10656.rs @@ -0,0 +1,3 @@ +#![deny(missing_docs)] +#![crate_type="lib"] +//~^^ ERROR missing documentation for the crate diff --git a/tests/ui/issues/issue-10656.stderr b/tests/ui/issues/issue-10656.stderr new file mode 100644 index 000000000..2e4365f1e --- /dev/null +++ b/tests/ui/issues/issue-10656.stderr @@ -0,0 +1,15 @@ +error: missing documentation for the crate + --> $DIR/issue-10656.rs:1:1 + | +LL | / #![deny(missing_docs)] +LL | | #![crate_type="lib"] + | |____________________^ + | +note: the lint level is defined here + --> $DIR/issue-10656.rs:1:9 + | +LL | #![deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-10682.rs b/tests/ui/issues/issue-10682.rs new file mode 100644 index 000000000..72e4559d3 --- /dev/null +++ b/tests/ui/issues/issue-10682.rs @@ -0,0 +1,13 @@ +// run-pass +// Regression test for issue #10682 +// Nested `proc` usage can't use outer owned data + +// pretty-expanded FIXME #23616 + +fn work(_: Box<isize>) {} +fn foo<F:FnOnce()>(_: F) {} + +pub fn main() { + let a = Box::new(1); + foo(move|| { foo(move|| { work(a) }) }) +} diff --git a/tests/ui/issues/issue-10683.rs b/tests/ui/issues/issue-10683.rs new file mode 100644 index 000000000..dcb221f8c --- /dev/null +++ b/tests/ui/issues/issue-10683.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +static NAME: &'static str = "hello world"; + +fn main() { + match &*NAME.to_ascii_lowercase() { + "foo" => {} + _ => {} + } +} diff --git a/tests/ui/issues/issue-10718.rs b/tests/ui/issues/issue-10718.rs new file mode 100644 index 000000000..a1de0cfe6 --- /dev/null +++ b/tests/ui/issues/issue-10718.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +fn f<F:FnOnce()>(p: F) { + p(); +} + +pub fn main() { + let p = || (); + f(p); +} diff --git a/tests/ui/issues/issue-10734.rs b/tests/ui/issues/issue-10734.rs new file mode 100644 index 000000000..723e6ed22 --- /dev/null +++ b/tests/ui/issues/issue-10734.rs @@ -0,0 +1,36 @@ +// run-pass +#![allow(non_upper_case_globals)] + +static mut drop_count: usize = 0; + +struct Foo { + dropped: bool +} + +impl Drop for Foo { + fn drop(&mut self) { + // Test to make sure we haven't dropped already + assert!(!self.dropped); + self.dropped = true; + // And record the fact that we dropped for verification later + unsafe { drop_count += 1; } + } +} + +pub fn main() { + // An `if true { expr }` statement should compile the same as `{ expr }`. + if true { + let _a = Foo{ dropped: false }; + } + // Check that we dropped already (as expected from a `{ expr }`). + unsafe { assert_eq!(drop_count, 1); } + + // An `if false {} else { expr }` statement should compile the same as `{ expr }`. + if false { + panic!(); + } else { + let _a = Foo{ dropped: false }; + } + // Check that we dropped already (as expected from a `{ expr }`). + unsafe { assert_eq!(drop_count, 2); } +} diff --git a/tests/ui/issues/issue-10764.rs b/tests/ui/issues/issue-10764.rs new file mode 100644 index 000000000..bb915f58d --- /dev/null +++ b/tests/ui/issues/issue-10764.rs @@ -0,0 +1,5 @@ +fn f(_: extern "Rust" fn()) {} +extern "C" fn bar() {} + +fn main() { f(bar) } +//~^ ERROR mismatched types diff --git a/tests/ui/issues/issue-10764.stderr b/tests/ui/issues/issue-10764.stderr new file mode 100644 index 000000000..4d8a85a13 --- /dev/null +++ b/tests/ui/issues/issue-10764.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-10764.rs:4:15 + | +LL | fn main() { f(bar) } + | - ^^^ expected "Rust" fn, found "C" fn + | | + | arguments to this function are incorrect + | + = note: expected fn pointer `fn()` + found fn item `extern "C" fn() {bar}` +note: function defined here + --> $DIR/issue-10764.rs:1:4 + | +LL | fn f(_: extern "Rust" fn()) {} + | ^ --------------------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-10767.rs b/tests/ui/issues/issue-10767.rs new file mode 100644 index 000000000..5670cd458 --- /dev/null +++ b/tests/ui/issues/issue-10767.rs @@ -0,0 +1,8 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + fn f() { + } + let _: Box<fn()> = Box::new(f as fn()); +} diff --git a/tests/ui/issues/issue-10802.rs b/tests/ui/issues/issue-10802.rs new file mode 100644 index 000000000..99e1a92df --- /dev/null +++ b/tests/ui/issues/issue-10802.rs @@ -0,0 +1,45 @@ +// run-pass +#![allow(dead_code)] + +struct DroppableStruct; +enum DroppableEnum { + DroppableVariant1, DroppableVariant2 +} + +static mut DROPPED: bool = false; + +impl Drop for DroppableStruct { + fn drop(&mut self) { + unsafe { DROPPED = true; } + } +} +impl Drop for DroppableEnum { + fn drop(&mut self) { + unsafe { DROPPED = true; } + } +} + +trait MyTrait { fn dummy(&self) { } } +impl MyTrait for Box<DroppableStruct> {} +impl MyTrait for Box<DroppableEnum> {} + +struct Whatever { w: Box<dyn MyTrait+'static> } +impl Whatever { + fn new(w: Box<dyn MyTrait+'static>) -> Whatever { + Whatever { w: w } + } +} + +fn main() { + { + let f: Box<_> = Box::new(DroppableStruct); + let _a = Whatever::new(Box::new(f) as Box<dyn MyTrait>); + } + assert!(unsafe { DROPPED }); + unsafe { DROPPED = false; } + { + let f: Box<_> = Box::new(DroppableEnum::DroppableVariant1); + let _a = Whatever::new(Box::new(f) as Box<dyn MyTrait>); + } + assert!(unsafe { DROPPED }); +} diff --git a/tests/ui/issues/issue-10806.rs b/tests/ui/issues/issue-10806.rs new file mode 100644 index 000000000..2f1d7bb5a --- /dev/null +++ b/tests/ui/issues/issue-10806.rs @@ -0,0 +1,38 @@ +// run-pass +#![allow(unused_imports)] + +// pretty-expanded FIXME #23616 + +pub fn foo() -> isize { + 3 +} +pub fn bar() -> isize { + 4 +} + +pub mod baz { + use {foo, bar}; + pub fn quux() -> isize { + foo() + bar() + } +} + +pub mod grault { + use {foo}; + pub fn garply() -> isize { + foo() + } +} + +pub mod waldo { + use {}; + pub fn plugh() -> isize { + 0 + } +} + +pub fn main() { + let _x = baz::quux(); + let _y = grault::garply(); + let _z = waldo::plugh(); +} diff --git a/tests/ui/issues/issue-10853.rs b/tests/ui/issues/issue-10853.rs new file mode 100644 index 000000000..3dcabf9b1 --- /dev/null +++ b/tests/ui/issues/issue-10853.rs @@ -0,0 +1,15 @@ +// check-pass +// pretty-expanded FIXME #23616 + +#![deny(missing_docs)] +#![doc="module"] + +#[doc="struct"] +pub struct Foo; + +pub fn foo() { + #![doc="fn"] +} + +#[doc="main"] +pub fn main() {} diff --git a/tests/ui/issues/issue-10877.rs b/tests/ui/issues/issue-10877.rs new file mode 100644 index 000000000..15a383175 --- /dev/null +++ b/tests/ui/issues/issue-10877.rs @@ -0,0 +1,16 @@ +struct Foo { + x: isize, +} +extern "C" { + fn foo(1: ()); + //~^ ERROR: patterns aren't allowed in foreign function declarations + fn bar((): isize); + //~^ ERROR: patterns aren't allowed in foreign function declarations + fn baz(Foo { x }: isize); + //~^ ERROR: patterns aren't allowed in foreign function declarations + fn qux((x, y): ()); + //~^ ERROR: patterns aren't allowed in foreign function declarations + fn this_is_actually_ok(a: usize); + fn and_so_is_this(_: usize); +} +fn main() {} diff --git a/tests/ui/issues/issue-10877.stderr b/tests/ui/issues/issue-10877.stderr new file mode 100644 index 000000000..bd3797cba --- /dev/null +++ b/tests/ui/issues/issue-10877.stderr @@ -0,0 +1,27 @@ +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/issue-10877.rs:5:12 + | +LL | fn foo(1: ()); + | ^ pattern not allowed in foreign function + +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/issue-10877.rs:7:12 + | +LL | fn bar((): isize); + | ^^ pattern not allowed in foreign function + +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/issue-10877.rs:9:12 + | +LL | fn baz(Foo { x }: isize); + | ^^^^^^^^^ pattern not allowed in foreign function + +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/issue-10877.rs:11:12 + | +LL | fn qux((x, y): ()); + | ^^^^^^ pattern not allowed in foreign function + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0130`. diff --git a/tests/ui/issues/issue-10902.rs b/tests/ui/issues/issue-10902.rs new file mode 100644 index 000000000..162482d49 --- /dev/null +++ b/tests/ui/issues/issue-10902.rs @@ -0,0 +1,21 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub mod two_tuple { + pub trait T { fn dummy(&self) { } } + pub struct P<'a>(&'a (dyn T + 'a), &'a (dyn T + 'a)); + pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> { + P(car, cdr) + } +} + +pub mod two_fields { + pub trait T { fn dummy(&self) { } } + pub struct P<'a> { car: &'a (dyn T + 'a), cdr: &'a (dyn T + 'a) } + pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> { + P{ car: car, cdr: cdr } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-11004.rs b/tests/ui/issues/issue-11004.rs new file mode 100644 index 000000000..10ef1f5e3 --- /dev/null +++ b/tests/ui/issues/issue-11004.rs @@ -0,0 +1,27 @@ +use std::mem; + +struct A { x: i32, y: f64 } + +#[cfg(not(works))] +unsafe fn access(n:*mut A) -> (i32, f64) { + let x : i32 = n.x; //~ no field `x` on type `*mut A` + let y : f64 = n.y; //~ no field `y` on type `*mut A` + (x, y) +} + +#[cfg(works)] +unsafe fn access(n:*mut A) -> (i32, f64) { + let x : i32 = (*n).x; + let y : f64 = (*n).y; + (x, y) +} + +fn main() { + let a : A = A { x: 3, y: 3.14 }; + let p : &A = &a; + let (x,y) = unsafe { + let n : *mut A = mem::transmute(p); + access(n) + }; + println!("x: {}, y: {}", x, y); +} diff --git a/tests/ui/issues/issue-11004.stderr b/tests/ui/issues/issue-11004.stderr new file mode 100644 index 000000000..b5831e42e --- /dev/null +++ b/tests/ui/issues/issue-11004.stderr @@ -0,0 +1,19 @@ +error[E0609]: no field `x` on type `*mut A` + --> $DIR/issue-11004.rs:7:21 + | +LL | let x : i32 = n.x; + | --^ + | | + | help: `n` is a raw pointer; try dereferencing it: `(*n).x` + +error[E0609]: no field `y` on type `*mut A` + --> $DIR/issue-11004.rs:8:21 + | +LL | let y : f64 = n.y; + | --^ + | | + | help: `n` is a raw pointer; try dereferencing it: `(*n).y` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-11047.rs b/tests/ui/issues/issue-11047.rs new file mode 100644 index 000000000..1fb2b5bb3 --- /dev/null +++ b/tests/ui/issues/issue-11047.rs @@ -0,0 +1,26 @@ +// run-pass +// Test that static methods can be invoked on `type` aliases + +#![allow(unused_variables)] + +pub mod foo { + pub mod bar { + pub mod baz { + pub struct Qux; + + impl Qux { + pub fn new() {} + } + } + } +} + +fn main() { + + type Ham = foo::bar::baz::Qux; + let foo = foo::bar::baz::Qux::new(); // invoke directly + let bar = Ham::new(); // invoke via type alias + + type StringVec = Vec<String>; + let sv = StringVec::new(); +} diff --git a/tests/ui/issues/issue-11085.rs b/tests/ui/issues/issue-11085.rs new file mode 100644 index 000000000..47c03238b --- /dev/null +++ b/tests/ui/issues/issue-11085.rs @@ -0,0 +1,46 @@ +// run-pass +#![allow(dead_code)] +// compile-flags: --cfg foo + +// pretty-expanded FIXME #23616 + +struct Foo { + #[cfg(fail)] + bar: baz, + foo: isize, +} + +struct Foo2 { + #[cfg(foo)] + foo: isize, +} + +enum Bar1 { + Bar1_1, + #[cfg(fail)] + Bar1_2(NotAType), +} + +enum Bar2 { + #[cfg(fail)] + Bar2_1(NotAType), +} + +enum Bar3 { + Bar3_1 { + #[cfg(fail)] + foo: isize, + bar: isize, + } +} + +pub fn main() { + let _f = Foo { foo: 3 }; + let _f = Foo2 { foo: 3 }; + + match Bar1::Bar1_1 { + Bar1::Bar1_1 => {} + } + + let _f = Bar3::Bar3_1 { bar: 3 }; +} diff --git a/tests/ui/issues/issue-11192.rs b/tests/ui/issues/issue-11192.rs new file mode 100644 index 000000000..1a3d8c9fe --- /dev/null +++ b/tests/ui/issues/issue-11192.rs @@ -0,0 +1,22 @@ +struct Foo { + x: isize +} + + +impl Drop for Foo { + fn drop(&mut self) { + println!("drop {}", self.x); + } +} + + +fn main() { + let mut ptr: Box<_> = Box::new(Foo { x: 0 }); + let mut test = |foo: &Foo| { + println!("access {}", foo.x); + ptr = Box::new(Foo { x: ptr.x + 1 }); + println!("access {}", foo.x); + }; + test(&*ptr); + //~^ ERROR: cannot borrow `*ptr` as immutable +} diff --git a/tests/ui/issues/issue-11192.stderr b/tests/ui/issues/issue-11192.stderr new file mode 100644 index 000000000..fc1548013 --- /dev/null +++ b/tests/ui/issues/issue-11192.stderr @@ -0,0 +1,17 @@ +error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable + --> $DIR/issue-11192.rs:20:10 + | +LL | let mut test = |foo: &Foo| { + | ----------- mutable borrow occurs here +LL | println!("access {}", foo.x); +LL | ptr = Box::new(Foo { x: ptr.x + 1 }); + | --- first borrow occurs due to use of `ptr` in closure +... +LL | test(&*ptr); + | ---- ^^^^^ immutable borrow occurs here + | | + | mutable borrow later used by call + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/issues/issue-11205.rs b/tests/ui/issues/issue-11205.rs new file mode 100644 index 000000000..ce0951eaf --- /dev/null +++ b/tests/ui/issues/issue-11205.rs @@ -0,0 +1,85 @@ +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +trait Foo { fn dummy(&self) { } } +impl Foo for isize {} +fn foo(_: [&dyn Foo; 2]) {} +fn foos(_: &[&dyn Foo]) {} +fn foog<T>(_: &[T], _: &[T]) {} + +fn bar(_: [Box<dyn Foo>; 2]) {} +fn bars(_: &[Box<dyn Foo+'static>]) {} + +fn main() { + let x: [&dyn Foo; 2] = [&1, &2]; + foo(x); + foo([&1, &2]); + + let r = &1; + let x: [&dyn Foo; 2] = [r; 2]; + foo(x); + foo([&1; 2]); + + let x: &[&dyn Foo] = &[&1, &2]; + foos(x); + foos(&[&1, &2]); + + let x: &[&dyn Foo] = &[&1, &2]; + let r = &1; + foog(x, &[r]); + + let x: [Box<dyn Foo>; 2] = [Box::new(1), Box::new(2)]; + bar(x); + bar([Box::new(1), Box::new(2)]); + + let x: &[Box<dyn Foo+'static>] = &[Box::new(1), Box::new(2)]; + bars(x); + bars(&[Box::new(1), Box::new(2)]); + + let x: &[Box<dyn Foo+'static>] = &[Box::new(1), Box::new(2)]; + foog(x, &[Box::new(1)]); + + struct T<'a> { + t: [&'a (dyn Foo+'a); 2] + } + let _n = T { + t: [&1, &2] + }; + let r = &1; + let _n = T { + t: [r; 2] + }; + let x: [&dyn Foo; 2] = [&1, &2]; + let _n = T { + t: x + }; + + struct F<'b> { + t: &'b [&'b (dyn Foo+'b)] + } + let _n = F { + t: &[&1, &2] + }; + let r = &1; + let r: [&dyn Foo; 2] = [r; 2]; + let _n = F { + t: &r + }; + let x: [&dyn Foo; 2] = [&1, &2]; + let _n = F { + t: &x + }; + + struct M<'a> { + t: &'a [Box<dyn Foo+'static>] + } + let _n = M { + t: &[Box::new(1), Box::new(2)] + }; + let x: [Box<dyn Foo>; 2] = [Box::new(1), Box::new(2)]; + let _n = M { + t: &x + }; +} diff --git a/tests/ui/issues/issue-11224.rs b/tests/ui/issues/issue-11224.rs new file mode 100644 index 000000000..e1c1df99a --- /dev/null +++ b/tests/ui/issues/issue-11224.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-11224.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_11224 as unused; + +pub fn main() {} diff --git a/tests/ui/issues/issue-11267.rs b/tests/ui/issues/issue-11267.rs new file mode 100644 index 000000000..848ed6ac7 --- /dev/null +++ b/tests/ui/issues/issue-11267.rs @@ -0,0 +1,19 @@ +// run-pass +// Tests that unary structs can be mutably borrowed. + +struct Empty; + +trait T<U> { + fn next(&mut self) -> Option<U>; +} +impl T<isize> for Empty { + fn next(&mut self) -> Option<isize> { None } +} + +fn do_something_with(a : &mut dyn T<isize>) { + println!("{:?}", a.next()) +} + +pub fn main() { + do_something_with(&mut Empty); +} diff --git a/tests/ui/issues/issue-11374.rs b/tests/ui/issues/issue-11374.rs new file mode 100644 index 000000000..7519ba282 --- /dev/null +++ b/tests/ui/issues/issue-11374.rs @@ -0,0 +1,27 @@ +use std::io::{self, Read}; +use std::vec; + +pub struct Container<'a> { + reader: &'a mut dyn Read +} + +impl<'a> Container<'a> { + pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> { + Container { reader: reader } + } + + pub fn read_to(&mut self, vec: &mut [u8]) { + self.reader.read(vec); + } +} + +pub fn for_stdin<'a>() -> Container<'a> { + let mut r = io::stdin(); + Container::wrap(&mut r as &mut dyn io::Read) +} + +fn main() { + let mut c = for_stdin(); + let mut v = Vec::new(); + c.read_to(v); //~ ERROR E0308 +} diff --git a/tests/ui/issues/issue-11374.stderr b/tests/ui/issues/issue-11374.stderr new file mode 100644 index 000000000..ace77814a --- /dev/null +++ b/tests/ui/issues/issue-11374.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-11374.rs:26:15 + | +LL | c.read_to(v); + | ------- ^ + | | | + | | expected `&mut [u8]`, found struct `Vec` + | | help: consider mutably borrowing here: `&mut v` + | arguments to this method are incorrect + | + = note: expected mutable reference `&mut [u8]` + found struct `Vec<_>` +note: associated function defined here + --> $DIR/issue-11374.rs:13:12 + | +LL | pub fn read_to(&mut self, vec: &mut [u8]) { + | ^^^^^^^ -------------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-11382.rs b/tests/ui/issues/issue-11382.rs new file mode 100644 index 000000000..42a7a0d04 --- /dev/null +++ b/tests/ui/issues/issue-11382.rs @@ -0,0 +1,4 @@ +// run-pass +fn main() { + println!("{}", 1.2); +} diff --git a/tests/ui/issues/issue-11384.rs b/tests/ui/issues/issue-11384.rs new file mode 100644 index 000000000..0105b4d22 --- /dev/null +++ b/tests/ui/issues/issue-11384.rs @@ -0,0 +1,10 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait Common { fn dummy(&self) { } } + +impl<'t, T> Common for (T, &'t T) {} + +impl<'t, T> Common for (&'t T, T) {} + +fn main() {} diff --git a/tests/ui/issues/issue-11508.rs b/tests/ui/issues/issue-11508.rs new file mode 100644 index 000000000..49868b73e --- /dev/null +++ b/tests/ui/issues/issue-11508.rs @@ -0,0 +1,11 @@ +// 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); +} diff --git a/tests/ui/issues/issue-11515.rs b/tests/ui/issues/issue-11515.rs new file mode 100644 index 000000000..b5c942f96 --- /dev/null +++ b/tests/ui/issues/issue-11515.rs @@ -0,0 +1,10 @@ +struct Test { + func: Box<dyn FnMut() + 'static>, +} + + + +fn main() { + let closure: Box<dyn Fn() + 'static> = Box::new(|| ()); + let test = Box::new(Test { func: closure }); //~ ERROR trait upcasting coercion is experimental [E0658] +} diff --git a/tests/ui/issues/issue-11515.stderr b/tests/ui/issues/issue-11515.stderr new file mode 100644 index 000000000..accd47f0f --- /dev/null +++ b/tests/ui/issues/issue-11515.stderr @@ -0,0 +1,13 @@ +error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental + --> $DIR/issue-11515.rs:9:38 + | +LL | let test = Box::new(Test { func: closure }); + | ^^^^^^^ + | + = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information + = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable + = note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-11529.rs b/tests/ui/issues/issue-11529.rs new file mode 100644 index 000000000..9a6cc8e9f --- /dev/null +++ b/tests/ui/issues/issue-11529.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-11529.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_11529 as a; + +fn main() { + let one = 1; + let _a = a::A(&one); +} diff --git a/tests/ui/issues/issue-11552.rs b/tests/ui/issues/issue-11552.rs new file mode 100644 index 000000000..9fb9f3d2e --- /dev/null +++ b/tests/ui/issues/issue-11552.rs @@ -0,0 +1,24 @@ +// 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))))) + ); +} diff --git a/tests/ui/issues/issue-11592.rs b/tests/ui/issues/issue-11592.rs new file mode 100644 index 000000000..a4611f2f9 --- /dev/null +++ b/tests/ui/issues/issue-11592.rs @@ -0,0 +1,11 @@ +// 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() { } diff --git a/tests/ui/issues/issue-11593.rs b/tests/ui/issues/issue-11593.rs new file mode 100644 index 000000000..8bf034e82 --- /dev/null +++ b/tests/ui/issues/issue-11593.rs @@ -0,0 +1,10 @@ +// aux-build:private-trait-xc.rs + +extern crate private_trait_xc; + +struct Bar; + +impl private_trait_xc::Foo for Bar {} +//~^ ERROR: trait `Foo` is private + +fn main() {} diff --git a/tests/ui/issues/issue-11593.stderr b/tests/ui/issues/issue-11593.stderr new file mode 100644 index 000000000..aa9768b18 --- /dev/null +++ b/tests/ui/issues/issue-11593.stderr @@ -0,0 +1,15 @@ +error[E0603]: trait `Foo` is private + --> $DIR/issue-11593.rs:7:24 + | +LL | impl private_trait_xc::Foo for Bar {} + | ^^^ private trait + | +note: the trait `Foo` is defined here + --> $DIR/auxiliary/private-trait-xc.rs:1:1 + | +LL | trait Foo {} + | ^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/issues/issue-11677.rs b/tests/ui/issues/issue-11677.rs new file mode 100644 index 000000000..be18c736f --- /dev/null +++ b/tests/ui/issues/issue-11677.rs @@ -0,0 +1,23 @@ +// 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) }; +} diff --git a/tests/ui/issues/issue-11680.rs b/tests/ui/issues/issue-11680.rs new file mode 100644 index 000000000..bfa8f5c5a --- /dev/null +++ b/tests/ui/issues/issue-11680.rs @@ -0,0 +1,11 @@ +// aux-build:issue-11680.rs + +extern crate issue_11680 as other; + +fn main() { + let _b = other::Foo::Bar(1); + //~^ ERROR: enum `Foo` is private + + let _b = other::test::Foo::Bar(1); + //~^ ERROR: enum `Foo` is private +} diff --git a/tests/ui/issues/issue-11680.stderr b/tests/ui/issues/issue-11680.stderr new file mode 100644 index 000000000..ea224af8e --- /dev/null +++ b/tests/ui/issues/issue-11680.stderr @@ -0,0 +1,27 @@ +error[E0603]: enum `Foo` is private + --> $DIR/issue-11680.rs:6:21 + | +LL | let _b = other::Foo::Bar(1); + | ^^^ private enum + | +note: the enum `Foo` is defined here + --> $DIR/auxiliary/issue-11680.rs:1:1 + | +LL | enum Foo { + | ^^^^^^^^ + +error[E0603]: enum `Foo` is private + --> $DIR/issue-11680.rs:9:27 + | +LL | let _b = other::test::Foo::Bar(1); + | ^^^ private enum + | +note: the enum `Foo` is defined here + --> $DIR/auxiliary/issue-11680.rs:6:5 + | +LL | enum Foo { + | ^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/issues/issue-11681.rs b/tests/ui/issues/issue-11681.rs new file mode 100644 index 000000000..6d8810d80 --- /dev/null +++ b/tests/ui/issues/issue-11681.rs @@ -0,0 +1,19 @@ +// This tests verifies that unary structs and enum variants +// are treated as rvalues and their lifetime is not bounded to +// the static scope. + +struct Test; + +impl Drop for Test { + fn drop (&mut self) {} +} + +fn createTest<'a>() -> &'a Test { + let testValue = &Test; + return testValue; //~ ERROR cannot return value referencing temporary value +} + + +pub fn main() { + createTest(); +} diff --git a/tests/ui/issues/issue-11681.stderr b/tests/ui/issues/issue-11681.stderr new file mode 100644 index 000000000..f2f930766 --- /dev/null +++ b/tests/ui/issues/issue-11681.stderr @@ -0,0 +1,11 @@ +error[E0515]: cannot return value referencing temporary value + --> $DIR/issue-11681.rs:13:10 + | +LL | let testValue = &Test; + | ---- temporary value created here +LL | return testValue; + | ^^^^^^^^^ returns a value referencing data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-11692-1.rs b/tests/ui/issues/issue-11692-1.rs new file mode 100644 index 000000000..b6f3bb8ef --- /dev/null +++ b/tests/ui/issues/issue-11692-1.rs @@ -0,0 +1,3 @@ +fn main() { + print!(testo!()); //~ ERROR cannot find macro `testo` in this scope +} diff --git a/tests/ui/issues/issue-11692-1.stderr b/tests/ui/issues/issue-11692-1.stderr new file mode 100644 index 000000000..386463436 --- /dev/null +++ b/tests/ui/issues/issue-11692-1.stderr @@ -0,0 +1,8 @@ +error: cannot find macro `testo` in this scope + --> $DIR/issue-11692-1.rs:2:12 + | +LL | print!(testo!()); + | ^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-11692-2.rs b/tests/ui/issues/issue-11692-2.rs new file mode 100644 index 000000000..5957ed338 --- /dev/null +++ b/tests/ui/issues/issue-11692-2.rs @@ -0,0 +1,3 @@ +fn main() { + concat!(test!()); //~ ERROR cannot find macro `test` in this scope +} diff --git a/tests/ui/issues/issue-11692-2.stderr b/tests/ui/issues/issue-11692-2.stderr new file mode 100644 index 000000000..84746ca2c --- /dev/null +++ b/tests/ui/issues/issue-11692-2.stderr @@ -0,0 +1,10 @@ +error: cannot find macro `test` in this scope + --> $DIR/issue-11692-2.rs:2:13 + | +LL | concat!(test!()); + | ^^^^ + | + = note: `test` is in scope, but it is an attribute: `#[test]` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-11709.rs b/tests/ui/issues/issue-11709.rs new file mode 100644 index 000000000..cb5e3dff3 --- /dev/null +++ b/tests/ui/issues/issue-11709.rs @@ -0,0 +1,38 @@ +// run-pass +#![allow(dead_code)] +// ignore-pretty issue #37199 + +// Don't panic on blocks without results +// There are several tests in this run-pass that raised +// when this bug was opened. The cases where the compiler +// panics before the fix have a comment. + +struct S {x:()} + +fn test(slot: &mut Option<Box<dyn FnMut() -> Box<dyn FnMut()>>>) -> () { + let a = slot.take(); + let _a = match a { + // `{let .. a(); }` would break + Some(mut a) => { let _a = a(); }, + None => (), + }; +} + +fn not(b: bool) -> bool { + if b { + !b + } else { + // `panic!(...)` would break + panic!("Break the compiler"); + } +} + +pub fn main() { + // {} would break + let _r = {}; + let mut slot = None; + // `{ test(...); }` would break + let _s : S = S{ x: { test(&mut slot); } }; + + let _b = not(true); +} diff --git a/tests/ui/issues/issue-11740.rs b/tests/ui/issues/issue-11740.rs new file mode 100644 index 000000000..9faeb7770 --- /dev/null +++ b/tests/ui/issues/issue-11740.rs @@ -0,0 +1,28 @@ +// check-pass +// revisions: mir thir +// [thir]compile-flags: -Zthir-unsafeck + +struct Attr { + name: String, + value: String, +} + +struct Element { + attrs: Vec<Box<Attr>>, +} + +impl Element { + pub unsafe fn get_attr<'a>(&'a self, name: &str) { + self.attrs + .iter() + .find(|attr| { + let attr: &&Box<Attr> = std::mem::transmute(attr); + true + }); + } +} + +fn main() { + let element = Element { attrs: Vec::new() }; + let _ = unsafe { element.get_attr("foo") }; +} diff --git a/tests/ui/issues/issue-11771.rs b/tests/ui/issues/issue-11771.rs new file mode 100644 index 000000000..c69cd1e79 --- /dev/null +++ b/tests/ui/issues/issue-11771.rs @@ -0,0 +1,11 @@ +fn main() { + let x = (); + 1 + + x //~^ ERROR E0277 + ; + + let x: () = (); + 1 + + x //~^ ERROR E0277 + ; +} diff --git a/tests/ui/issues/issue-11771.stderr b/tests/ui/issues/issue-11771.stderr new file mode 100644 index 000000000..161fce4b0 --- /dev/null +++ b/tests/ui/issues/issue-11771.stderr @@ -0,0 +1,39 @@ +error[E0277]: cannot add `()` to `{integer}` + --> $DIR/issue-11771.rs:3:7 + | +LL | 1 + + | ^ no implementation for `{integer} + ()` + | + = help: the trait `Add<()>` is not implemented for `{integer}` + = help: the following other types implement trait `Add<Rhs>`: + <&'a f32 as Add<f32>> + <&'a f64 as Add<f64>> + <&'a i128 as Add<i128>> + <&'a i16 as Add<i16>> + <&'a i32 as Add<i32>> + <&'a i64 as Add<i64>> + <&'a i8 as Add<i8>> + <&'a isize as Add<isize>> + and 48 others + +error[E0277]: cannot add `()` to `{integer}` + --> $DIR/issue-11771.rs:8:7 + | +LL | 1 + + | ^ no implementation for `{integer} + ()` + | + = help: the trait `Add<()>` is not implemented for `{integer}` + = help: the following other types implement trait `Add<Rhs>`: + <&'a f32 as Add<f32>> + <&'a f64 as Add<f64>> + <&'a i128 as Add<i128>> + <&'a i16 as Add<i16>> + <&'a i32 as Add<i32>> + <&'a i64 as Add<i64>> + <&'a i8 as Add<i8>> + <&'a isize as Add<isize>> + and 48 others + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-11820.rs b/tests/ui/issues/issue-11820.rs new file mode 100644 index 000000000..7ffe96527 --- /dev/null +++ b/tests/ui/issues/issue-11820.rs @@ -0,0 +1,12 @@ +// run-pass +// pretty-expanded FIXME #23616 + +struct NoClone; + +fn main() { + let rnc = &NoClone; + let rsnc = &Some(NoClone); + + let _: &NoClone = rnc.clone(); + let _: &Option<NoClone> = rsnc.clone(); +} diff --git a/tests/ui/issues/issue-11844.rs b/tests/ui/issues/issue-11844.rs new file mode 100644 index 000000000..f974a4702 --- /dev/null +++ b/tests/ui/issues/issue-11844.rs @@ -0,0 +1,8 @@ +fn main() { + let a = Some(Box::new(1)); + match a { + Ok(a) => //~ ERROR: mismatched types + println!("{}",a), + None => panic!() + } +} diff --git a/tests/ui/issues/issue-11844.stderr b/tests/ui/issues/issue-11844.stderr new file mode 100644 index 000000000..81cf918a1 --- /dev/null +++ b/tests/ui/issues/issue-11844.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-11844.rs:4:9 + | +LL | match a { + | - this expression has type `Option<Box<{integer}>>` +LL | Ok(a) => + | ^^^^^ expected enum `Option`, found enum `Result` + | + = note: expected enum `Option<Box<{integer}>>` + found enum `Result<_, _>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-11869.rs b/tests/ui/issues/issue-11869.rs new file mode 100644 index 000000000..b300f4593 --- /dev/null +++ b/tests/ui/issues/issue-11869.rs @@ -0,0 +1,17 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +struct A { + a: String +} + +fn borrow<'a>(binding: &'a A) -> &'a str { + match &*binding.a { + "in" => "in_", + "ref" => "ref_", + ident => ident + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-11873.rs b/tests/ui/issues/issue-11873.rs new file mode 100644 index 000000000..d3bd05caf --- /dev/null +++ b/tests/ui/issues/issue-11873.rs @@ -0,0 +1,7 @@ +fn main() { + let mut v = vec![1]; + let mut f = || v.push(2); + let _w = v; //~ ERROR: cannot move out of `v` + + f(); +} diff --git a/tests/ui/issues/issue-11873.stderr b/tests/ui/issues/issue-11873.stderr new file mode 100644 index 000000000..c814eedd2 --- /dev/null +++ b/tests/ui/issues/issue-11873.stderr @@ -0,0 +1,16 @@ +error[E0505]: cannot move out of `v` because it is borrowed + --> $DIR/issue-11873.rs:4:14 + | +LL | let mut f = || v.push(2); + | -- - borrow occurs due to use in closure + | | + | borrow of `v` occurs here +LL | let _w = v; + | ^ move out of `v` occurs here +LL | +LL | f(); + | - borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/issues/issue-11958.rs b/tests/ui/issues/issue-11958.rs new file mode 100644 index 000000000..a7af01e25 --- /dev/null +++ b/tests/ui/issues/issue-11958.rs @@ -0,0 +1,11 @@ +// run-pass + +// We shouldn't need to rebind a moved upvar as mut if it's already +// marked as mut + +pub fn main() { + let mut x = 1; + let _thunk = Box::new(move|| { x = 2; }); + //~^ WARN value assigned to `x` is never read + //~| WARN unused variable: `x` +} diff --git a/tests/ui/issues/issue-11958.stderr b/tests/ui/issues/issue-11958.stderr new file mode 100644 index 000000000..5dca4c2f0 --- /dev/null +++ b/tests/ui/issues/issue-11958.stderr @@ -0,0 +1,20 @@ +warning: value assigned to `x` is never read + --> $DIR/issue-11958.rs:8:36 + | +LL | let _thunk = Box::new(move|| { x = 2; }); + | ^ + | + = help: maybe it is overwritten before being read? + = note: `#[warn(unused_assignments)]` on by default + +warning: unused variable: `x` + --> $DIR/issue-11958.rs:8:36 + | +LL | let _thunk = Box::new(move|| { x = 2; }); + | ^ + | + = help: did you mean to capture by reference instead? + = note: `#[warn(unused_variables)]` on by default + +warning: 2 warnings emitted + diff --git a/tests/ui/issues/issue-12028.rs b/tests/ui/issues/issue-12028.rs new file mode 100644 index 000000000..7503766ff --- /dev/null +++ b/tests/ui/issues/issue-12028.rs @@ -0,0 +1,38 @@ +// Test an example where we fail to infer the type parameter H. This +// is because there is really nothing constraining it. At one time, we +// would infer based on the where clauses in scope, but that no longer +// works. + +trait Hash<H> { + fn hash2(&self, hasher: &H) -> u64; +} + +trait Stream { + fn input(&mut self, bytes: &[u8]); + fn result(&self) -> u64; +} + +trait StreamHasher { + type S : Stream; + fn stream(&self) -> Self::S; +} + +trait StreamHash<H: StreamHasher>: Hash<H> { + fn input_stream(&self, stream: &mut H::S); +} + +impl<H: StreamHasher> Hash<H> for u8 { + fn hash2(&self, hasher: &H) -> u64 { + let mut stream = hasher.stream(); + self.input_stream(&mut stream); //~ ERROR type annotations needed + Stream::result(&stream) + } +} + +impl<H: StreamHasher> StreamHash<H> for u8 { + fn input_stream(&self, stream: &mut H::S) { + Stream::input(stream, &[*self]); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-12028.stderr b/tests/ui/issues/issue-12028.stderr new file mode 100644 index 000000000..8d6b81c24 --- /dev/null +++ b/tests/ui/issues/issue-12028.stderr @@ -0,0 +1,15 @@ +error[E0284]: type annotations needed + --> $DIR/issue-12028.rs:27:14 + | +LL | self.input_stream(&mut stream); + | ^^^^^^^^^^^^ + | + = note: cannot satisfy `<_ as StreamHasher>::S == <H as StreamHasher>::S` +help: try using a fully qualified path to specify the expected types + | +LL | <u8 as StreamHash<H>>::input_stream(self, &mut stream); + | ++++++++++++++++++++++++++++++++++++ ~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/issues/issue-12033.rs b/tests/ui/issues/issue-12033.rs new file mode 100644 index 000000000..9dc7573c9 --- /dev/null +++ b/tests/ui/issues/issue-12033.rs @@ -0,0 +1,7 @@ +// run-pass +use std::cell::RefCell; + +fn main() { + let x = RefCell::new(0); + if *x.borrow() == 0 {} else {} +} diff --git a/tests/ui/issues/issue-12041.rs b/tests/ui/issues/issue-12041.rs new file mode 100644 index 000000000..091e8fe8b --- /dev/null +++ b/tests/ui/issues/issue-12041.rs @@ -0,0 +1,13 @@ +use std::sync::mpsc::channel; +use std::thread; + +fn main() { + let (tx, rx) = channel(); + let _t = thread::spawn(move|| -> () { + loop { + let tx = tx; + //~^ ERROR: use of moved value: `tx` + tx.send(1); + } + }); +} diff --git a/tests/ui/issues/issue-12041.stderr b/tests/ui/issues/issue-12041.stderr new file mode 100644 index 000000000..b9ffa499a --- /dev/null +++ b/tests/ui/issues/issue-12041.stderr @@ -0,0 +1,11 @@ +error[E0382]: use of moved value: `tx` + --> $DIR/issue-12041.rs:8:22 + | +LL | let tx = tx; + | ^^ value moved here, in previous iteration of loop + | + = note: move occurs because `tx` has type `Sender<i32>`, which does not implement the `Copy` trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-12127.rs b/tests/ui/issues/issue-12127.rs new file mode 100644 index 000000000..199d542e8 --- /dev/null +++ b/tests/ui/issues/issue-12127.rs @@ -0,0 +1,14 @@ +#![feature(unboxed_closures, tuple_trait)] + +fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f } +fn do_it(x: &isize) { } + +fn main() { + let x: Box<_> = Box::new(22); + let f = to_fn_once(move|| do_it(&*x)); + to_fn_once(move|| { + f(); + f(); + //~^ ERROR: use of moved value: `f` + })() +} diff --git a/tests/ui/issues/issue-12127.stderr b/tests/ui/issues/issue-12127.stderr new file mode 100644 index 000000000..2c451b07f --- /dev/null +++ b/tests/ui/issues/issue-12127.stderr @@ -0,0 +1,18 @@ +error[E0382]: use of moved value: `f` + --> $DIR/issue-12127.rs:11:9 + | +LL | f(); + | --- `f` moved due to this call +LL | f(); + | ^ value used here after move + | +note: this value implements `FnOnce`, which causes it to be moved when called + --> $DIR/issue-12127.rs:10:9 + | +LL | f(); + | ^ + = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:30]`, which does not implement the `Copy` trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-12133-1.rs b/tests/ui/issues/issue-12133-1.rs new file mode 100644 index 000000000..96ad5abd5 --- /dev/null +++ b/tests/ui/issues/issue-12133-1.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-12133-rlib.rs +// aux-build:issue-12133-dylib.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_12133_rlib as a; +extern crate issue_12133_dylib as b; + +fn main() {} diff --git a/tests/ui/issues/issue-12133-2.rs b/tests/ui/issues/issue-12133-2.rs new file mode 100644 index 000000000..02fec65c2 --- /dev/null +++ b/tests/ui/issues/issue-12133-2.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-12133-rlib.rs +// aux-build:issue-12133-dylib.rs +// no-prefer-dynamic + +// pretty-expanded FIXME #23616 + +extern crate issue_12133_rlib as a; +extern crate issue_12133_dylib as b; + +fn main() {} diff --git a/tests/ui/issues/issue-12133-3.rs b/tests/ui/issues/issue-12133-3.rs new file mode 100644 index 000000000..e6b16e2da --- /dev/null +++ b/tests/ui/issues/issue-12133-3.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:issue-12133-rlib.rs +// aux-build:issue-12133-dylib.rs +// aux-build:issue-12133-dylib2.rs +// ignore-emscripten no dylib support +// ignore-musl +// ignore-sgx no dylib support + +// pretty-expanded FIXME #23616 + +extern crate issue_12133_dylib2 as other; + +fn main() {} diff --git a/tests/ui/issues/issue-12187-1.rs b/tests/ui/issues/issue-12187-1.rs new file mode 100644 index 000000000..86128ed94 --- /dev/null +++ b/tests/ui/issues/issue-12187-1.rs @@ -0,0 +1,8 @@ +fn new<T>() -> &'static T { + panic!() +} + +fn main() { + let &v = new(); + //~^ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-12187-1.stderr b/tests/ui/issues/issue-12187-1.stderr new file mode 100644 index 000000000..806b7f0ac --- /dev/null +++ b/tests/ui/issues/issue-12187-1.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `&T` + --> $DIR/issue-12187-1.rs:6:9 + | +LL | let &v = new(); + | ^^ + | +help: consider giving this pattern a type, where the placeholders `_` are specified + | +LL | let &v: &T = new(); + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-12187-2.rs b/tests/ui/issues/issue-12187-2.rs new file mode 100644 index 000000000..080a6206b --- /dev/null +++ b/tests/ui/issues/issue-12187-2.rs @@ -0,0 +1,8 @@ +fn new<'r, T>() -> &'r T { + panic!() +} + +fn main() { + let &v = new(); + //~^ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-12187-2.stderr b/tests/ui/issues/issue-12187-2.stderr new file mode 100644 index 000000000..a1fa0a2b0 --- /dev/null +++ b/tests/ui/issues/issue-12187-2.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `&T` + --> $DIR/issue-12187-2.rs:6:9 + | +LL | let &v = new(); + | ^^ + | +help: consider giving this pattern a type, where the placeholders `_` are specified + | +LL | let &v: &T = new(); + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-12285.rs b/tests/ui/issues/issue-12285.rs new file mode 100644 index 000000000..24ac5d2fb --- /dev/null +++ b/tests/ui/issues/issue-12285.rs @@ -0,0 +1,14 @@ +// run-pass + +struct S; + +fn main() { + match Some(&S) { + Some(&S) => {}, + _x => unreachable!() + } + match Some(&S) { + Some(&S) => {}, + None => unreachable!() + } +} diff --git a/tests/ui/issues/issue-1251.rs b/tests/ui/issues/issue-1251.rs new file mode 100644 index 000000000..c2c047c79 --- /dev/null +++ b/tests/ui/issues/issue-1251.rs @@ -0,0 +1,16 @@ +// build-pass +#![allow(unused_attributes)] +#![allow(dead_code)] +// pretty-expanded FIXME #23616 +// ignore-wasm32-bare no libc to test ffi with +#![feature(rustc_private)] + +mod rustrt { + extern crate libc; + + extern "C" { + pub fn rust_get_test_int() -> libc::intptr_t; + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-12511.rs b/tests/ui/issues/issue-12511.rs new file mode 100644 index 000000000..ea83e3fd9 --- /dev/null +++ b/tests/ui/issues/issue-12511.rs @@ -0,0 +1,8 @@ +trait T1 : T2 { +//~^ ERROR cycle detected +} + +trait T2 : T1 { +} + +fn main() { } diff --git a/tests/ui/issues/issue-12511.stderr b/tests/ui/issues/issue-12511.stderr new file mode 100644 index 000000000..789a1141c --- /dev/null +++ b/tests/ui/issues/issue-12511.stderr @@ -0,0 +1,33 @@ +error[E0391]: cycle detected when computing the super predicates of `T1` + --> $DIR/issue-12511.rs:1:1 + | +LL | trait T1 : T2 { + | ^^^^^^^^^^^^^ + | +note: ...which requires computing the super traits of `T1`... + --> $DIR/issue-12511.rs:1:12 + | +LL | trait T1 : T2 { + | ^^ +note: ...which requires computing the super predicates of `T2`... + --> $DIR/issue-12511.rs:5:1 + | +LL | trait T2 : T1 { + | ^^^^^^^^^^^^^ +note: ...which requires computing the super traits of `T2`... + --> $DIR/issue-12511.rs:5:12 + | +LL | trait T2 : T1 { + | ^^ + = note: ...which again requires computing the super predicates of `T1`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-12511.rs:1:1 + | +LL | / trait T1 : T2 { +LL | | +LL | | } + | |_^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-12567.rs b/tests/ui/issues/issue-12567.rs new file mode 100644 index 000000000..1b2a37de4 --- /dev/null +++ b/tests/ui/issues/issue-12567.rs @@ -0,0 +1,13 @@ +fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) { + match (l1, l2) { + //~^ ERROR: cannot move out of type `[T]`, a non-copy slice + //~| ERROR: cannot move out of type `[T]`, a non-copy slice + (&[], &[]) => println!("both empty"), + (&[], &[hd, ..]) | (&[hd, ..], &[]) + => println!("one empty"), + (&[hd1, ..], &[hd2, ..]) + => println!("both nonempty"), + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-12567.stderr b/tests/ui/issues/issue-12567.stderr new file mode 100644 index 000000000..7fa06825f --- /dev/null +++ b/tests/ui/issues/issue-12567.stderr @@ -0,0 +1,47 @@ +error[E0508]: cannot move out of type `[T]`, a non-copy slice + --> $DIR/issue-12567.rs:2:11 + | +LL | match (l1, l2) { + | ^^^^^^^^ cannot move out of here +... +LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) + | -- data moved here +LL | => println!("one empty"), +LL | (&[hd1, ..], &[hd2, ..]) + | --- ...and here + | + = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[]) + | +++ +help: consider borrowing the pattern binding + | +LL | (&[ref hd1, ..], &[hd2, ..]) + | +++ + +error[E0508]: cannot move out of type `[T]`, a non-copy slice + --> $DIR/issue-12567.rs:2:11 + | +LL | match (l1, l2) { + | ^^^^^^^^ cannot move out of here +... +LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) + | -- data moved here +LL | => println!("one empty"), +LL | (&[hd1, ..], &[hd2, ..]) + | --- ...and here + | + = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[]) + | +++ +help: consider borrowing the pattern binding + | +LL | (&[hd1, ..], &[ref hd2, ..]) + | +++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0508`. diff --git a/tests/ui/issues/issue-1257.rs b/tests/ui/issues/issue-1257.rs new file mode 100644 index 000000000..de5a6d359 --- /dev/null +++ b/tests/ui/issues/issue-1257.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main () { + let mut line = "".to_string(); + let mut i = 0; + while line != "exit".to_string() { + line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; + i += 1; + } +} diff --git a/tests/ui/issues/issue-12612.rs b/tests/ui/issues/issue-12612.rs new file mode 100644 index 000000000..d254f6941 --- /dev/null +++ b/tests/ui/issues/issue-12612.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(unused_imports)] +// aux-build:issue-12612-1.rs +// aux-build:issue-12612-2.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_12612_1 as foo; +extern crate issue_12612_2 as bar; + +mod test { + use bar::baz; +} + +fn main() {} diff --git a/tests/ui/issues/issue-12660.rs b/tests/ui/issues/issue-12660.rs new file mode 100644 index 000000000..44c492b43 --- /dev/null +++ b/tests/ui/issues/issue-12660.rs @@ -0,0 +1,14 @@ +// run-pass +// aux-build:issue-12660-aux.rs + +// pretty-expanded FIXME #23616 + +extern crate issue12660aux; + +use issue12660aux::{my_fn, MyStruct}; + +#[allow(path_statements)] +fn main() { + my_fn(MyStruct); + MyStruct; +} diff --git a/tests/ui/issues/issue-12677.rs b/tests/ui/issues/issue-12677.rs new file mode 100644 index 000000000..d0e4c17d4 --- /dev/null +++ b/tests/ui/issues/issue-12677.rs @@ -0,0 +1,9 @@ +// run-pass + +fn main() { + let s = "Hello"; + let first = s.bytes(); + let second = first.clone(); + + assert_eq!(first.collect::<Vec<u8>>(), second.collect::<Vec<u8>>()) +} diff --git a/tests/ui/issues/issue-12699.rs b/tests/ui/issues/issue-12699.rs new file mode 100644 index 000000000..e26c2d7cd --- /dev/null +++ b/tests/ui/issues/issue-12699.rs @@ -0,0 +1,10 @@ +// run-pass +// ignore-wasm32-bare can't block the thread +// ignore-sgx not supported +#![allow(deprecated)] + +use std::thread; + +fn main() { + thread::sleep_ms(250); +} diff --git a/tests/ui/issues/issue-12729.rs b/tests/ui/issues/issue-12729.rs new file mode 100644 index 000000000..aa0b04af2 --- /dev/null +++ b/tests/ui/issues/issue-12729.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub struct Foo; + +mod bar { + use Foo; + + impl Foo { + fn baz(&self) {} + } +} +fn main() {} diff --git a/tests/ui/issues/issue-12744.rs b/tests/ui/issues/issue-12744.rs new file mode 100644 index 000000000..e2756ec97 --- /dev/null +++ b/tests/ui/issues/issue-12744.rs @@ -0,0 +1,5 @@ +// run-pass +fn main() { + fn test() -> Box<dyn std::any::Any + 'static> { Box::new(1) } + println!("{:?}", test()) +} diff --git a/tests/ui/issues/issue-12860.rs b/tests/ui/issues/issue-12860.rs new file mode 100644 index 000000000..01b642cdf --- /dev/null +++ b/tests/ui/issues/issue-12860.rs @@ -0,0 +1,49 @@ +// run-pass +use std::collections::HashSet; + +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +struct XYZ { + x: isize, + y: isize, + z: isize +} + +fn main() { + let mut connected = HashSet::new(); + let mut border = HashSet::new(); + + let middle = XYZ{x: 0, y: 0, z: 0}; + border.insert(middle); + + while !border.is_empty() && connected.len() < 10000 { + let choice = *(border.iter().next().unwrap()); + border.remove(&choice); + connected.insert(choice); + + let cxp = XYZ{x: choice.x + 1, y: choice.y, z: choice.z}; + let cxm = XYZ{x: choice.x - 1, y: choice.y, z: choice.z}; + let cyp = XYZ{x: choice.x, y: choice.y + 1, z: choice.z}; + let cym = XYZ{x: choice.x, y: choice.y - 1, z: choice.z}; + let czp = XYZ{x: choice.x, y: choice.y, z: choice.z + 1}; + let czm = XYZ{x: choice.x, y: choice.y, z: choice.z - 1}; + + if !connected.contains(&cxp) { + border.insert(cxp); + } + if !connected.contains(&cxm){ + border.insert(cxm); + } + if !connected.contains(&cyp){ + border.insert(cyp); + } + if !connected.contains(&cym) { + border.insert(cym); + } + if !connected.contains(&czp){ + border.insert(czp); + } + if !connected.contains(&czm) { + border.insert(czm); + } + } +} diff --git a/tests/ui/issues/issue-12863.rs b/tests/ui/issues/issue-12863.rs new file mode 100644 index 000000000..1ac1c3d81 --- /dev/null +++ b/tests/ui/issues/issue-12863.rs @@ -0,0 +1,8 @@ +mod foo { pub fn bar() {} } + +fn main() { + match () { + foo::bar => {} + //~^ ERROR expected unit struct, unit variant or constant, found function `foo::bar` + } +} diff --git a/tests/ui/issues/issue-12863.stderr b/tests/ui/issues/issue-12863.stderr new file mode 100644 index 000000000..9c29a37cb --- /dev/null +++ b/tests/ui/issues/issue-12863.stderr @@ -0,0 +1,9 @@ +error[E0532]: expected unit struct, unit variant or constant, found function `foo::bar` + --> $DIR/issue-12863.rs:5:9 + | +LL | foo::bar => {} + | ^^^^^^^^ not a unit struct, unit variant or constant + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/issues/issue-12909.rs b/tests/ui/issues/issue-12909.rs new file mode 100644 index 000000000..a68d73a00 --- /dev/null +++ b/tests/ui/issues/issue-12909.rs @@ -0,0 +1,20 @@ +// run-pass +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +use std::collections::HashMap; + +fn copy<T: Copy>(&x: &T) -> T { + x +} + +fn main() { + let arr = [(1, 1), (2, 2), (3, 3)]; + + let v1: Vec<&_> = arr.iter().collect(); + let v2: Vec<_> = arr.iter().map(copy).collect(); + + let m1: HashMap<_, _> = arr.iter().map(copy).collect(); + let m2: HashMap<isize, _> = arr.iter().map(copy).collect(); + let m3: HashMap<_, usize> = arr.iter().map(copy).collect(); +} diff --git a/tests/ui/issues/issue-12920.rs b/tests/ui/issues/issue-12920.rs new file mode 100644 index 000000000..a0cfea055 --- /dev/null +++ b/tests/ui/issues/issue-12920.rs @@ -0,0 +1,8 @@ +// run-fail +// error-pattern:explicit panic +// ignore-emscripten no processes + +pub fn main() { + panic!(); + println!("{}", 1); +} diff --git a/tests/ui/issues/issue-12997-1.rs b/tests/ui/issues/issue-12997-1.rs new file mode 100644 index 000000000..9f808dac3 --- /dev/null +++ b/tests/ui/issues/issue-12997-1.rs @@ -0,0 +1,11 @@ +// compile-flags: --test + +//! Test that makes sure wrongly-typed bench functions aren't ignored + +#![feature(test)] + +#[bench] +fn foo() { } //~ ERROR functions used as benches + +#[bench] +fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches diff --git a/tests/ui/issues/issue-12997-1.stderr b/tests/ui/issues/issue-12997-1.stderr new file mode 100644 index 000000000..00c605174 --- /dev/null +++ b/tests/ui/issues/issue-12997-1.stderr @@ -0,0 +1,14 @@ +error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` + --> $DIR/issue-12997-1.rs:8:1 + | +LL | fn foo() { } + | ^^^^^^^^^^^^ + +error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` + --> $DIR/issue-12997-1.rs:11:1 + | +LL | fn bar(x: isize, y: isize) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-12997-2.rs b/tests/ui/issues/issue-12997-2.rs new file mode 100644 index 000000000..9df965315 --- /dev/null +++ b/tests/ui/issues/issue-12997-2.rs @@ -0,0 +1,9 @@ +// compile-flags: --test + +//! Test that makes sure wrongly-typed bench functions are rejected + +#![feature(test)] + +#[bench] +fn bar(x: isize) { } +//~^ ERROR mismatched types diff --git a/tests/ui/issues/issue-12997-2.stderr b/tests/ui/issues/issue-12997-2.stderr new file mode 100644 index 000000000..2a3d0e345 --- /dev/null +++ b/tests/ui/issues/issue-12997-2.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-12997-2.rs:8:1 + | +LL | #[bench] + | -------- in this procedural macro expansion +LL | fn bar(x: isize) { } + | ^^^^^^^^^^^^^^^^^^^^ + | | + | expected `isize`, found `&mut Bencher` + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-12997-2.rs:8:4 + | +LL | fn bar(x: isize) { } + | ^^^ -------- + = note: this error originates in the attribute macro `bench` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-13027.rs b/tests/ui/issues/issue-13027.rs new file mode 100644 index 000000000..64bf2a11d --- /dev/null +++ b/tests/ui/issues/issue-13027.rs @@ -0,0 +1,178 @@ +// run-pass + +// Tests that match expression handles overlapped literal and range +// properly in the presence of guard function. + +fn val() -> usize { 1 } + +static CONST: usize = 1; + +pub fn main() { + lit_shadow_range(); + range_shadow_lit(); + range_shadow_range(); + multi_pats_shadow_lit(); + multi_pats_shadow_range(); + lit_shadow_multi_pats(); + range_shadow_multi_pats(); + misc(); +} + +fn lit_shadow_range() { + assert_eq!(2, match 1 { + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + assert_eq!(2, match val() { + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + assert_eq!(2, match CONST { + 0 => 0, + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + // value is out of the range of second arm, should match wildcard pattern + assert_eq!(3, match 3 { + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); +} + +fn range_shadow_lit() { + assert_eq!(2, match 1 { + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + assert_eq!(2, match val() { + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + assert_eq!(2, match CONST { + 0 => 0, + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + // ditto + assert_eq!(3, match 3 { + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); +} + +fn range_shadow_range() { + assert_eq!(2, match 1 { + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + let x = 0; + assert_eq!(2, match x+1 { + 100 => 0, + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + assert_eq!(2, match val() { + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + assert_eq!(2, match CONST { + 100 => 0, + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + // ditto + assert_eq!(3, match 5 { + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); +} + +fn multi_pats_shadow_lit() { + assert_eq!(2, match 1 { + 100 => 0, + 0 | 1..=10 if false => 1, + 1 => 2, + _ => 3, + }); +} + +fn multi_pats_shadow_range() { + assert_eq!(2, match 1 { + 100 => 0, + 0 | 1..=10 if false => 1, + 1..=3 => 2, + _ => 3, + }); +} + +fn lit_shadow_multi_pats() { + assert_eq!(2, match 1 { + 100 => 0, + 1 if false => 1, + 0 | 1..=10 => 2, + _ => 3, + }); +} + +fn range_shadow_multi_pats() { + assert_eq!(2, match 1 { + 100 => 0, + 1..=3 if false => 1, + 0 | 1..=10 => 2, + _ => 3, + }); +} + +fn misc() { + enum Foo { + Bar(#[allow(unused_tuple_struct_fields)] usize, bool) + } + // This test basically mimics how trace_macros! macro is implemented, + // which is a rare combination of vector patterns, multiple wild-card + // patterns and guard functions. + let r = match [Foo::Bar(0, false)] { + [Foo::Bar(_, pred)] if pred => 1, + [Foo::Bar(_, pred)] if !pred => 2, + _ => 0, + }; + assert_eq!(2, r); +} diff --git a/tests/ui/issues/issue-13033.rs b/tests/ui/issues/issue-13033.rs new file mode 100644 index 000000000..fdb356e70 --- /dev/null +++ b/tests/ui/issues/issue-13033.rs @@ -0,0 +1,14 @@ +trait Foo { + fn bar(&mut self, other: &mut dyn Foo); +} + +struct Baz; + +impl Foo for Baz { + fn bar(&mut self, other: &dyn Foo) {} + //~^ ERROR method `bar` has an incompatible type for trait + //~| expected signature `fn(&mut Baz, &mut dyn Foo)` + //~| found signature `fn(&mut Baz, &dyn Foo)` +} + +fn main() {} diff --git a/tests/ui/issues/issue-13033.stderr b/tests/ui/issues/issue-13033.stderr new file mode 100644 index 000000000..db2c1189e --- /dev/null +++ b/tests/ui/issues/issue-13033.stderr @@ -0,0 +1,20 @@ +error[E0053]: method `bar` has an incompatible type for trait + --> $DIR/issue-13033.rs:8:30 + | +LL | fn bar(&mut self, other: &dyn Foo) {} + | ^^^^^^^^ + | | + | types differ in mutability + | help: change the parameter type to match the trait: `&mut dyn Foo` + | +note: type in trait + --> $DIR/issue-13033.rs:2:30 + | +LL | fn bar(&mut self, other: &mut dyn Foo); + | ^^^^^^^^^^^^ + = note: expected signature `fn(&mut Baz, &mut dyn Foo)` + found signature `fn(&mut Baz, &dyn Foo)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/issues/issue-13058.rs b/tests/ui/issues/issue-13058.rs new file mode 100644 index 000000000..a5806feb7 --- /dev/null +++ b/tests/ui/issues/issue-13058.rs @@ -0,0 +1,27 @@ +use std::ops::Range; + +trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; } + +impl<'r> Itble<'r, usize, Range<usize>> for (usize, usize) { + fn iter(&'r self) -> Range<usize> { + let &(min, max) = self; + min..max + } +} + +fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool +{ + let cont_iter = cont.iter(); +//~^ ERROR explicit lifetime required in the type of `cont` [E0621] + let result = cont_iter.fold(Some(0), |state, val| { + state.map_or(None, |mask| { + let bit = 1 << val; + if mask & bit == 0 {Some(mask|bit)} else {None} + }) + }); + result.is_some() +} + +fn main() { + check(&(3, 5)); +} diff --git a/tests/ui/issues/issue-13058.stderr b/tests/ui/issues/issue-13058.stderr new file mode 100644 index 000000000..8368978de --- /dev/null +++ b/tests/ui/issues/issue-13058.stderr @@ -0,0 +1,12 @@ +error[E0621]: explicit lifetime required in the type of `cont` + --> $DIR/issue-13058.rs:14:21 + | +LL | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool + | -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T` +LL | { +LL | let cont_iter = cont.iter(); + | ^^^^^^^^^^^ lifetime `'r` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/issues/issue-13105.rs b/tests/ui/issues/issue-13105.rs new file mode 100644 index 000000000..15a98c779 --- /dev/null +++ b/tests/ui/issues/issue-13105.rs @@ -0,0 +1,9 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait Foo { + #[allow(anonymous_parameters)] + fn quux(u8) {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-13167.rs b/tests/ui/issues/issue-13167.rs new file mode 100644 index 000000000..8584c98de --- /dev/null +++ b/tests/ui/issues/issue-13167.rs @@ -0,0 +1,22 @@ +// check-pass +// pretty-expanded FIXME #23616 + +use std::slice; + +pub struct PhfMapEntries<'a, T: 'a> { + iter: slice::Iter<'a, (&'static str, T)>, +} + +impl<'a, T> Iterator for PhfMapEntries<'a, T> { + type Item = (&'static str, &'a T); + + fn next(&mut self) -> Option<(&'static str, &'a T)> { + self.iter.by_ref().map(|&(key, ref value)| (key, value)).next() + } + + fn size_hint(&self) -> (usize, Option<usize>) { + self.iter.size_hint() + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-13202.rs b/tests/ui/issues/issue-13202.rs new file mode 100644 index 000000000..16debb5b6 --- /dev/null +++ b/tests/ui/issues/issue-13202.rs @@ -0,0 +1,7 @@ +// run-fail +// error-pattern:bad input +// ignore-emscripten no processes + +fn main() { + Some("foo").unwrap_or(panic!("bad input")).to_string(); +} diff --git a/tests/ui/issues/issue-13204.rs b/tests/ui/issues/issue-13204.rs new file mode 100644 index 000000000..3d6aba845 --- /dev/null +++ b/tests/ui/issues/issue-13204.rs @@ -0,0 +1,25 @@ +// run-pass +#![allow(unused_mut)] +// Test that when instantiating trait default methods, typeck handles +// lifetime parameters defined on the method bound correctly. + + +pub trait Foo { + fn bar<'a, I: Iterator<Item=&'a ()>>(&self, it: I) -> usize { + let mut xs = it.filter(|_| true); + xs.count() + } +} + +pub struct Baz; + +impl Foo for Baz { + // When instantiating `Foo::bar` for `Baz` here, typeck used to + // ICE due to the lifetime parameter of `bar`. +} + +fn main() { + let x = Baz; + let y = vec![(), (), ()]; + assert_eq!(x.bar(y.iter()), 3); +} diff --git a/tests/ui/issues/issue-13214.rs b/tests/ui/issues/issue-13214.rs new file mode 100644 index 000000000..0cf8d0675 --- /dev/null +++ b/tests/ui/issues/issue-13214.rs @@ -0,0 +1,23 @@ +// build-pass +#![allow(dead_code)] +// defining static with struct that contains enum +// with &'static str variant used to cause ICE + +// pretty-expanded FIXME #23616 + +pub enum Foo { + Bar, + Baz(&'static str), +} + +pub static TEST: Test = Test { + foo: Foo::Bar, + c: 'a' +}; + +pub struct Test { + foo: Foo, + c: char, +} + +fn main() {} diff --git a/tests/ui/issues/issue-13259-windows-tcb-trash.rs b/tests/ui/issues/issue-13259-windows-tcb-trash.rs new file mode 100644 index 000000000..740e7780d --- /dev/null +++ b/tests/ui/issues/issue-13259-windows-tcb-trash.rs @@ -0,0 +1,42 @@ +// run-pass +#![feature(rustc_private)] + +extern crate libc; + +#[cfg(windows)] +mod imp { + type LPVOID = *mut u8; + type DWORD = u32; + type LPWSTR = *mut u16; + + extern "system" { + fn FormatMessageW(flags: DWORD, + lpSrc: LPVOID, + msgId: DWORD, + langId: DWORD, + buf: LPWSTR, + nsize: DWORD, + args: *const u8) + -> DWORD; + } + + pub fn test() { + let mut buf: [u16; 50] = [0; 50]; + let ret = unsafe { + FormatMessageW(0x1000, core::ptr::null_mut(), 1, 0x400, + buf.as_mut_ptr(), buf.len() as u32, core::ptr::null()) + }; + // On some 32-bit Windowses (Win7-8 at least) this will panic with segmented + // stacks taking control of pvArbitrary + assert!(ret != 0); + } +} + +#[cfg(not(windows))] +mod imp { + pub fn test() { } +} + +fn main() { + imp::test() +} diff --git a/tests/ui/issues/issue-13264.rs b/tests/ui/issues/issue-13264.rs new file mode 100644 index 000000000..691bb63a2 --- /dev/null +++ b/tests/ui/issues/issue-13264.rs @@ -0,0 +1,74 @@ +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +use std::ops::Deref; + +struct Root { + jsref: JSRef +} + +impl Deref for Root { + type Target = JSRef; + + fn deref<'a>(&'a self) -> &'a JSRef { + &self.jsref + } +} + +#[derive(Copy, Clone)] +struct JSRef { + node: *const Node +} + +impl Deref for JSRef { + type Target = Node; + + fn deref<'a>(&'a self) -> &'a Node { + self.get() + } +} + +trait INode { + fn RemoveChild(&self); +} + +impl INode for JSRef { + fn RemoveChild(&self) { + self.get().RemoveChild(0) + } +} + +impl JSRef { + fn AddChild(&self) { + self.get().AddChild(0); + } + + fn get<'a>(&'a self) -> &'a Node { + unsafe { + &*self.node + } + } +} + +struct Node; + +impl Node { + fn RemoveChild(&self, _a: usize) { + } + + fn AddChild(&self, _a: usize) { + } +} + +fn main() { + let n = Node; + let jsref = JSRef { node: &n }; + let root = Root { jsref: jsref }; + + root.AddChild(); + jsref.AddChild(); + + root.RemoveChild(); + jsref.RemoveChild(); +} diff --git a/tests/ui/issues/issue-13323.rs b/tests/ui/issues/issue-13323.rs new file mode 100644 index 000000000..71e14d4da --- /dev/null +++ b/tests/ui/issues/issue-13323.rs @@ -0,0 +1,58 @@ +// run-pass + +struct StrWrap { + s: String +} + +impl StrWrap { + fn new(s: &str) -> StrWrap { + StrWrap { s: s.to_string() } + } + + fn get_s<'a>(&'a self) -> &'a str { + &self.s + } +} + +struct MyStruct { + s: StrWrap +} + +impl MyStruct { + fn new(s: &str) -> MyStruct { + MyStruct { s: StrWrap::new(s) } + } + + fn get_str_wrap<'a>(&'a self) -> &'a StrWrap { + &self.s + } +} + +trait Matcher<T> { + fn matches(&self, actual: T) -> bool; +} + +fn assert_that<T, U: Matcher<T>>(actual: T, matcher: &U) { + assert!(matcher.matches(actual)); +} + +struct EqualTo<T> { + expected: T +} + +impl<T: Eq> Matcher<T> for EqualTo<T> { + fn matches(&self, actual: T) -> bool { + self.expected.eq(&actual) + } +} + +fn equal_to<T: Eq>(expected: T) -> Box<EqualTo<T>> { + Box::new(EqualTo { expected: expected }) +} + +pub fn main() { + let my_struct = MyStruct::new("zomg"); + let s = my_struct.get_str_wrap(); + + assert_that(s.get_s(), &*equal_to("zomg")); +} diff --git a/tests/ui/issues/issue-13359.rs b/tests/ui/issues/issue-13359.rs new file mode 100644 index 000000000..9129790c5 --- /dev/null +++ b/tests/ui/issues/issue-13359.rs @@ -0,0 +1,13 @@ +fn foo(_s: i16) { } + +fn bar(_s: u32) { } + +fn main() { + foo(1*(1 as isize)); + //~^ ERROR mismatched types + //~| expected `i16`, found `isize` + + bar(1*(1 as usize)); + //~^ ERROR mismatched types + //~| expected `u32`, found `usize` +} diff --git a/tests/ui/issues/issue-13359.stderr b/tests/ui/issues/issue-13359.stderr new file mode 100644 index 000000000..fef63680a --- /dev/null +++ b/tests/ui/issues/issue-13359.stderr @@ -0,0 +1,39 @@ +error[E0308]: mismatched types + --> $DIR/issue-13359.rs:6:9 + | +LL | foo(1*(1 as isize)); + | --- ^^^^^^^^^^^^^^ expected `i16`, found `isize` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-13359.rs:1:4 + | +LL | fn foo(_s: i16) { } + | ^^^ ------- +help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit + | +LL | foo((1*(1 as isize)).try_into().unwrap()); + | + +++++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-13359.rs:10:9 + | +LL | bar(1*(1 as usize)); + | --- ^^^^^^^^^^^^^^ expected `u32`, found `usize` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-13359.rs:3:4 + | +LL | fn bar(_s: u32) { } + | ^^^ ------- +help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit + | +LL | bar((1*(1 as usize)).try_into().unwrap()); + | + +++++++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-13405.rs b/tests/ui/issues/issue-13405.rs new file mode 100644 index 000000000..732172b23 --- /dev/null +++ b/tests/ui/issues/issue-13405.rs @@ -0,0 +1,20 @@ +// check-pass +#![allow(dead_code)] +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +struct Foo<'a> { + i: &'a bool, + j: Option<&'a isize>, +} + +impl<'a> Foo<'a> { + fn bar(&mut self, j: &isize) { + let child = Foo { + i: self.i, + j: Some(j) + }; + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-13407.rs b/tests/ui/issues/issue-13407.rs new file mode 100644 index 000000000..7ea81ffb5 --- /dev/null +++ b/tests/ui/issues/issue-13407.rs @@ -0,0 +1,9 @@ +mod A { + struct C; +} + +fn main() { + A::C = 1; + //~^ ERROR: invalid left-hand side of assignment + //~| ERROR: struct `C` is private +} diff --git a/tests/ui/issues/issue-13407.stderr b/tests/ui/issues/issue-13407.stderr new file mode 100644 index 000000000..54b6c640d --- /dev/null +++ b/tests/ui/issues/issue-13407.stderr @@ -0,0 +1,24 @@ +error[E0603]: unit struct `C` is private + --> $DIR/issue-13407.rs:6:8 + | +LL | A::C = 1; + | ^ private unit struct + | +note: the unit struct `C` is defined here + --> $DIR/issue-13407.rs:2:5 + | +LL | struct C; + | ^^^^^^^^^ + +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-13407.rs:6:10 + | +LL | A::C = 1; + | ---- ^ + | | + | cannot assign to this expression + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0070, E0603. +For more information about an error, try `rustc --explain E0070`. diff --git a/tests/ui/issues/issue-13434.rs b/tests/ui/issues/issue-13434.rs new file mode 100644 index 000000000..1b7d3e201 --- /dev/null +++ b/tests/ui/issues/issue-13434.rs @@ -0,0 +1,21 @@ +// run-pass +#[derive(Debug)] +struct MyStruct; + +trait Repro { + fn repro(self, s: MyStruct) -> String; +} + +impl<F> Repro for F where F: FnOnce(MyStruct) -> String { + fn repro(self, s: MyStruct) -> String { + self(s) + } +} + +fn do_stuff<R: Repro>(r: R) -> String { + r.repro(MyStruct) +} + +pub fn main() { + assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{:?}", s))); +} diff --git a/tests/ui/issues/issue-13446.rs b/tests/ui/issues/issue-13446.rs new file mode 100644 index 000000000..9f1fc4277 --- /dev/null +++ b/tests/ui/issues/issue-13446.rs @@ -0,0 +1,6 @@ +// Used to cause ICE + +static VEC: [u32; 256] = vec![]; +//~^ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/issues/issue-13446.stderr b/tests/ui/issues/issue-13446.stderr new file mode 100644 index 000000000..30fb73dd3 --- /dev/null +++ b/tests/ui/issues/issue-13446.stderr @@ -0,0 +1,13 @@ +error[E0308]: mismatched types + --> $DIR/issue-13446.rs:3:26 + | +LL | static VEC: [u32; 256] = vec![]; + | ^^^^^^ expected array `[u32; 256]`, found struct `Vec` + | + = note: expected array `[u32; 256]` + found struct `Vec<_>` + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-13466.rs b/tests/ui/issues/issue-13466.rs new file mode 100644 index 000000000..a420c7704 --- /dev/null +++ b/tests/ui/issues/issue-13466.rs @@ -0,0 +1,20 @@ +// Regression test for #13466 + +pub fn main() { + // The expected arm type `Option<T>` has one type parameter, while + // the actual arm `Result<T, E>` has two. typeck should not be + // tricked into looking up a non-existing second type parameter. + let _x: usize = match Some(1) { + Ok(u) => u, + //~^ ERROR mismatched types + //~| expected enum `Option<{integer}>` + //~| found enum `Result<_, _>` + //~| expected enum `Option`, found enum `Result` + + Err(e) => panic!(e) + //~^ ERROR mismatched types + //~| expected enum `Option<{integer}>` + //~| found enum `Result<_, _>` + //~| expected enum `Option`, found enum `Result` + }; +} diff --git a/tests/ui/issues/issue-13466.stderr b/tests/ui/issues/issue-13466.stderr new file mode 100644 index 000000000..c78466f4e --- /dev/null +++ b/tests/ui/issues/issue-13466.stderr @@ -0,0 +1,26 @@ +error[E0308]: mismatched types + --> $DIR/issue-13466.rs:8:9 + | +LL | let _x: usize = match Some(1) { + | ------- this expression has type `Option<{integer}>` +LL | Ok(u) => u, + | ^^^^^ expected enum `Option`, found enum `Result` + | + = note: expected enum `Option<{integer}>` + found enum `Result<_, _>` + +error[E0308]: mismatched types + --> $DIR/issue-13466.rs:14:9 + | +LL | let _x: usize = match Some(1) { + | ------- this expression has type `Option<{integer}>` +... +LL | Err(e) => panic!(e) + | ^^^^^^ expected enum `Option`, found enum `Result` + | + = note: expected enum `Option<{integer}>` + found enum `Result<_, _>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-13482-2.rs b/tests/ui/issues/issue-13482-2.rs new file mode 100644 index 000000000..bbcb954af --- /dev/null +++ b/tests/ui/issues/issue-13482-2.rs @@ -0,0 +1,9 @@ +// compile-flags:-Z verbose + +fn main() { + let x = [1,2]; + let y = match x { + [] => None, //~ ERROR pattern requires 0 elements but array has 2 + [a,_] => Some(a) + }; +} diff --git a/tests/ui/issues/issue-13482-2.stderr b/tests/ui/issues/issue-13482-2.stderr new file mode 100644 index 000000000..ccab95878 --- /dev/null +++ b/tests/ui/issues/issue-13482-2.stderr @@ -0,0 +1,9 @@ +error[E0527]: pattern requires 0 elements but array has 2 + --> $DIR/issue-13482-2.rs:6:9 + | +LL | [] => None, + | ^^ expected 2 elements + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0527`. diff --git a/tests/ui/issues/issue-13482.rs b/tests/ui/issues/issue-13482.rs new file mode 100644 index 000000000..244b3237e --- /dev/null +++ b/tests/ui/issues/issue-13482.rs @@ -0,0 +1,7 @@ +fn main() { + let x = [1,2]; + let y = match x { + [] => None, //~ ERROR pattern requires 0 elements but array has 2 + [a,_] => Some(a) + }; +} diff --git a/tests/ui/issues/issue-13482.stderr b/tests/ui/issues/issue-13482.stderr new file mode 100644 index 000000000..3eb05f504 --- /dev/null +++ b/tests/ui/issues/issue-13482.stderr @@ -0,0 +1,9 @@ +error[E0527]: pattern requires 0 elements but array has 2 + --> $DIR/issue-13482.rs:4:5 + | +LL | [] => None, + | ^^ expected 2 elements + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0527`. diff --git a/tests/ui/issues/issue-13497-2.rs b/tests/ui/issues/issue-13497-2.rs new file mode 100644 index 000000000..c82da0f00 --- /dev/null +++ b/tests/ui/issues/issue-13497-2.rs @@ -0,0 +1,7 @@ +fn read_lines_borrowed<'a>() -> Vec<&'a str> { + let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()]; + rawLines //~ ERROR cannot return value referencing local variable `rawLines` + .iter().map(|l| l.trim()).collect() +} + +fn main() {} diff --git a/tests/ui/issues/issue-13497-2.stderr b/tests/ui/issues/issue-13497-2.stderr new file mode 100644 index 000000000..a365e24e2 --- /dev/null +++ b/tests/ui/issues/issue-13497-2.stderr @@ -0,0 +1,12 @@ +error[E0515]: cannot return value referencing local variable `rawLines` + --> $DIR/issue-13497-2.rs:3:5 + | +LL | // rawLines +LL | || .iter().map(|l| l.trim()).collect() + | ||_______________-___________________________^ returns a value referencing data owned by the current function + | |_______________| + | `rawLines` is borrowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-13497.rs b/tests/ui/issues/issue-13497.rs new file mode 100644 index 000000000..4b2795aa8 --- /dev/null +++ b/tests/ui/issues/issue-13497.rs @@ -0,0 +1,8 @@ +fn read_lines_borrowed1() -> Vec< + &str //~ ERROR missing lifetime specifier +> { + let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()]; + rawLines.iter().map(|l| l.trim()).collect() +} + +fn main() {} diff --git a/tests/ui/issues/issue-13497.stderr b/tests/ui/issues/issue-13497.stderr new file mode 100644 index 000000000..4b1d979da --- /dev/null +++ b/tests/ui/issues/issue-13497.stderr @@ -0,0 +1,15 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-13497.rs:2:5 + | +LL | &str + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime + | +LL | &'static str + | +++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/issues/issue-13507-2.rs b/tests/ui/issues/issue-13507-2.rs new file mode 100644 index 000000000..63f3589c6 --- /dev/null +++ b/tests/ui/issues/issue-13507-2.rs @@ -0,0 +1,36 @@ +// run-pass +#![allow(unused_imports)] +// aux-build:issue-13507.rs + +extern crate issue_13507; +use issue_13507::testtypes; + +use std::any::TypeId; + +pub fn type_ids() -> Vec<TypeId> { + use issue_13507::testtypes::*; + vec![ + TypeId::of::<FooBool>(), + TypeId::of::<FooInt>(), + TypeId::of::<FooUint>(), + TypeId::of::<FooFloat>(), + TypeId::of::<FooStr>(), + TypeId::of::<FooArray>(), + TypeId::of::<FooSlice>(), + TypeId::of::<FooBox>(), + TypeId::of::<FooPtr>(), + TypeId::of::<FooRef>(), + TypeId::of::<FooFnPtr>(), + TypeId::of::<FooNil>(), + TypeId::of::<FooTuple>(), + TypeId::of::<dyn FooTrait>(), + TypeId::of::<FooStruct>(), + TypeId::of::<FooEnum>() + ] +} + +pub fn main() { + let othercrate = issue_13507::testtypes::type_ids(); + let thiscrate = type_ids(); + assert_eq!(thiscrate, othercrate); +} diff --git a/tests/ui/issues/issue-1362.rs b/tests/ui/issues/issue-1362.rs new file mode 100644 index 000000000..6fd43f50e --- /dev/null +++ b/tests/ui/issues/issue-1362.rs @@ -0,0 +1,8 @@ +// Regression test for issue #1362 - without that fix the span will be bogus +// no-reformat +fn main() { + let x: u32 = 20i32; //~ ERROR mismatched types +} +// NOTE: Do not add any extra lines as the line number the error is +// on is significant; an error later in the source file might not +// trigger the bug. diff --git a/tests/ui/issues/issue-1362.stderr b/tests/ui/issues/issue-1362.stderr new file mode 100644 index 000000000..babbb6e51 --- /dev/null +++ b/tests/ui/issues/issue-1362.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/issue-1362.rs:4:16 + | +LL | let x: u32 = 20i32; + | --- ^^^^^ expected `u32`, found `i32` + | | + | expected due to this + | +help: change the type of the numeric literal from `i32` to `u32` + | +LL | let x: u32 = 20u32; + | ~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-13620.rs b/tests/ui/issues/issue-13620.rs new file mode 100644 index 000000000..3c3c19df7 --- /dev/null +++ b/tests/ui/issues/issue-13620.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-13620-1.rs +// aux-build:issue-13620-2.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_13620_2 as crate2; + +fn main() { + (crate2::FOO2.foo)(); +} diff --git a/tests/ui/issues/issue-13665.rs b/tests/ui/issues/issue-13665.rs new file mode 100644 index 000000000..a3843c650 --- /dev/null +++ b/tests/ui/issues/issue-13665.rs @@ -0,0 +1,15 @@ +// run-pass +// pretty-expanded FIXME #23616 + +fn foo<'r>() { + let maybe_value_ref: Option<&'r u8> = None; + + let _ = maybe_value_ref.map(|& ref v| v); + let _ = maybe_value_ref.map(|& ref v| -> &'r u8 {v}); + let _ = maybe_value_ref.map(|& ref v: &'r u8| -> &'r u8 {v}); + let _ = maybe_value_ref.map(|& ref v: &'r u8| {v}); +} + +fn main() { + foo(); +} diff --git a/tests/ui/issues/issue-13703.rs b/tests/ui/issues/issue-13703.rs new file mode 100644 index 000000000..424c99974 --- /dev/null +++ b/tests/ui/issues/issue-13703.rs @@ -0,0 +1,6 @@ +// check-pass +// pretty-expanded FIXME #23616 + +pub struct Foo<'a, 'b: 'a> { foo: &'a &'b isize } +pub fn foo<'a, 'b>(x: Foo<'a, 'b>, _o: Option<& & ()>) { let _y = x.foo; } +fn main() {} diff --git a/tests/ui/issues/issue-13763.rs b/tests/ui/issues/issue-13763.rs new file mode 100644 index 000000000..dd5f6dbc9 --- /dev/null +++ b/tests/ui/issues/issue-13763.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +mod u8 { + pub const BITS: usize = 8; +} + +const NUM: usize = u8::BITS; + +struct MyStruct { nums: [usize; 8] } + +fn main() { + let _s = MyStruct { nums: [0; NUM] }; +} diff --git a/tests/ui/issues/issue-13775.rs b/tests/ui/issues/issue-13775.rs new file mode 100644 index 000000000..f5977effc --- /dev/null +++ b/tests/ui/issues/issue-13775.rs @@ -0,0 +1,9 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait Foo { + #[allow(anonymous_parameters)] + fn bar(&self, isize) {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-13808.rs b/tests/ui/issues/issue-13808.rs new file mode 100644 index 000000000..9f9db067b --- /dev/null +++ b/tests/ui/issues/issue-13808.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +struct Foo<'a> { + listener: Box<dyn FnMut() + 'a>, +} + +impl<'a> Foo<'a> { + fn new<F>(listener: F) -> Foo<'a> where F: FnMut() + 'a { + Foo { listener: Box::new(listener) } + } +} + +fn main() { + let a = Foo::new(|| {}); +} diff --git a/tests/ui/issues/issue-13847.rs b/tests/ui/issues/issue-13847.rs new file mode 100644 index 000000000..06a0304ae --- /dev/null +++ b/tests/ui/issues/issue-13847.rs @@ -0,0 +1,3 @@ +fn main() { + return.is_failure //~ ERROR no field `is_failure` on type `!` +} diff --git a/tests/ui/issues/issue-13847.stderr b/tests/ui/issues/issue-13847.stderr new file mode 100644 index 000000000..52b8dc049 --- /dev/null +++ b/tests/ui/issues/issue-13847.stderr @@ -0,0 +1,9 @@ +error[E0609]: no field `is_failure` on type `!` + --> $DIR/issue-13847.rs:2:12 + | +LL | return.is_failure + | ^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-13867.rs b/tests/ui/issues/issue-13867.rs new file mode 100644 index 000000000..9510aae77 --- /dev/null +++ b/tests/ui/issues/issue-13867.rs @@ -0,0 +1,48 @@ +// run-pass +// Test that codegen works correctly when there are multiple refutable +// patterns in match expression. + +enum Foo { + FooUint(usize), + FooNullary, +} + +fn main() { + let r = match (Foo::FooNullary, 'a') { + (Foo::FooUint(..), 'a'..='z') => 1, + (Foo::FooNullary, 'x') => 2, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match (Foo::FooUint(0), 'a') { + (Foo::FooUint(1), 'a'..='z') => 1, + (Foo::FooUint(..), 'x') => 2, + (Foo::FooNullary, 'a') => 3, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match ('a', Foo::FooUint(0)) { + ('a'..='z', Foo::FooUint(1)) => 1, + ('x', Foo::FooUint(..)) => 2, + ('a', Foo::FooNullary) => 3, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match ('a', 'a') { + ('a'..='z', 'b') => 1, + ('x', 'a'..='z') => 2, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match ('a', 'a') { + ('a'..='z', 'b') => 1, + ('x', 'a'..='z') => 2, + ('a', 'a') => 3, + _ => 0 + }; + assert_eq!(r, 3); +} diff --git a/tests/ui/issues/issue-13872.rs b/tests/ui/issues/issue-13872.rs new file mode 100644 index 000000000..aade6b836 --- /dev/null +++ b/tests/ui/issues/issue-13872.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:issue-13872-1.rs +// aux-build:issue-13872-2.rs +// aux-build:issue-13872-3.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_13872_3 as other; + +fn main() { + other::foo(); +} diff --git a/tests/ui/issues/issue-14082.rs b/tests/ui/issues/issue-14082.rs new file mode 100644 index 000000000..52b8c8680 --- /dev/null +++ b/tests/ui/issues/issue-14082.rs @@ -0,0 +1,20 @@ +// check-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_imports, dead_code)] + +use foo::Foo; + +mod foo { + pub use m::Foo; // this should shadow d::Foo +} + +mod m { + pub struct Foo; +} + +mod d { + pub struct Foo; +} + +fn main() {} diff --git a/tests/ui/issues/issue-14091-2.rs b/tests/ui/issues/issue-14091-2.rs new file mode 100644 index 000000000..e2f6b1833 --- /dev/null +++ b/tests/ui/issues/issue-14091-2.rs @@ -0,0 +1,17 @@ +// + +// Very + +// sensitive +pub struct BytePos(pub u32); + +// to particular + +// line numberings / offsets + +fn main() { + let x = BytePos(1); + + assert!(x, x); + //~^ ERROR cannot apply unary operator `!` to type `BytePos` +} diff --git a/tests/ui/issues/issue-14091-2.stderr b/tests/ui/issues/issue-14091-2.stderr new file mode 100644 index 000000000..f8375d4ef --- /dev/null +++ b/tests/ui/issues/issue-14091-2.stderr @@ -0,0 +1,18 @@ +error[E0600]: cannot apply unary operator `!` to type `BytePos` + --> $DIR/issue-14091-2.rs:15:5 + | +LL | assert!(x, x); + | ^^^^^^^^^^^^^ cannot apply unary operator `!` + | +note: an implementation of `Not` might be missing for `BytePos` + --> $DIR/issue-14091-2.rs:6:1 + | +LL | pub struct BytePos(pub u32); + | ^^^^^^^^^^^^^^^^^^ must implement `Not` +note: the trait `Not` must be implemented + --> $SRC_DIR/core/src/ops/bit.rs:LL:COL + = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0600`. diff --git a/tests/ui/issues/issue-14091.rs b/tests/ui/issues/issue-14091.rs new file mode 100644 index 000000000..0ee20de90 --- /dev/null +++ b/tests/ui/issues/issue-14091.rs @@ -0,0 +1,4 @@ +fn main(){ + assert!(1,1); + //~^ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-14091.stderr b/tests/ui/issues/issue-14091.stderr new file mode 100644 index 000000000..0a9640a9e --- /dev/null +++ b/tests/ui/issues/issue-14091.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/issue-14091.rs:2:5 + | +LL | assert!(1,1); + | ^^^^^^^^^^^^ expected `bool`, found integer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-14092.rs b/tests/ui/issues/issue-14092.rs new file mode 100644 index 000000000..67c2a42ea --- /dev/null +++ b/tests/ui/issues/issue-14092.rs @@ -0,0 +1,4 @@ +fn fn1(0: Box) {} +//~^ ERROR missing generics for struct `Box` + +fn main() {} diff --git a/tests/ui/issues/issue-14092.stderr b/tests/ui/issues/issue-14092.stderr new file mode 100644 index 000000000..3a43627e6 --- /dev/null +++ b/tests/ui/issues/issue-14092.stderr @@ -0,0 +1,14 @@ +error[E0107]: missing generics for struct `Box` + --> $DIR/issue-14092.rs:1:11 + | +LL | fn fn1(0: Box) {} + | ^^^ expected at least 1 generic argument + | +help: add missing generic argument + | +LL | fn fn1(0: Box<T>) {} + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-14229.rs b/tests/ui/issues/issue-14229.rs new file mode 100644 index 000000000..477a2c650 --- /dev/null +++ b/tests/ui/issues/issue-14229.rs @@ -0,0 +1,21 @@ +// run-pass +trait Foo: Sized { + fn foo(self) {} +} + +trait Bar: Sized { + fn bar(self) {} +} + +struct S; + +impl<'l> Foo for &'l S {} + +impl<T: Foo> Bar for T {} + +fn main() { + let s = S; + s.foo(); + (&s).bar(); + s.bar(); +} diff --git a/tests/ui/issues/issue-14254.rs b/tests/ui/issues/issue-14254.rs new file mode 100644 index 000000000..6f9308376 --- /dev/null +++ b/tests/ui/issues/issue-14254.rs @@ -0,0 +1,93 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait Foo: Sized { + fn bar(&self); + fn baz(&self) { } + fn bah(_: Option<Self>) { } +} + +struct BarTy { + x : isize, + y : f64, +} + +impl BarTy { + fn a() {} + fn b(&self) {} +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for *const BarTy { + fn bar(&self) { + self.baz(); + BarTy::a(); + Foo::bah(None::<*const BarTy>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a BarTy { + fn bar(&self) { + self.baz(); + self.x; + self.y; + BarTy::a(); + Foo::bah(None::<&BarTy>); + self.b(); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a mut BarTy { + fn bar(&self) { + self.baz(); + self.x; + self.y; + BarTy::a(); + Foo::bah(None::<&mut BarTy>); + self.b(); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for Box<BarTy> { + fn bar(&self) { + self.baz(); + Foo::bah(None::<Box<BarTy>>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for *const isize { + fn bar(&self) { + self.baz(); + Foo::bah(None::<*const isize>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a isize { + fn bar(&self) { + self.baz(); + Foo::bah(None::<&isize>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a mut isize { + fn bar(&self) { + self.baz(); + Foo::bah(None::<&mut isize>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for Box<isize> { + fn bar(&self) { + self.baz(); + Foo::bah(None::<Box<isize>>); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-14285.rs b/tests/ui/issues/issue-14285.rs new file mode 100644 index 000000000..2ba9ff717 --- /dev/null +++ b/tests/ui/issues/issue-14285.rs @@ -0,0 +1,17 @@ +trait Foo { + fn dummy(&self) { } +} + +struct A; + +impl Foo for A {} + +struct B<'a>(&'a (dyn Foo + 'a)); + +fn foo<'a>(a: &dyn Foo) -> B<'a> { + B(a) //~ ERROR explicit lifetime required in the type of `a` [E0621] +} + +fn main() { + let _test = foo(&A); +} diff --git a/tests/ui/issues/issue-14285.stderr b/tests/ui/issues/issue-14285.stderr new file mode 100644 index 000000000..5c0706601 --- /dev/null +++ b/tests/ui/issues/issue-14285.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `a` + --> $DIR/issue-14285.rs:12:5 + | +LL | fn foo<'a>(a: &dyn Foo) -> B<'a> { + | -------- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` +LL | B(a) + | ^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/issues/issue-14308.rs b/tests/ui/issues/issue-14308.rs new file mode 100644 index 000000000..e067bcdf3 --- /dev/null +++ b/tests/ui/issues/issue-14308.rs @@ -0,0 +1,15 @@ +// run-pass + +struct A(isize); + +fn main() { + let x = match A(3) { + A(..) => 1 + }; + assert_eq!(x, 1); + let x = match A(4) { + A(1) => 1, + A(..) => 2 + }; + assert_eq!(x, 2); +} diff --git a/tests/ui/issues/issue-14330.rs b/tests/ui/issues/issue-14330.rs new file mode 100644 index 000000000..0844fc720 --- /dev/null +++ b/tests/ui/issues/issue-14330.rs @@ -0,0 +1,7 @@ +// check-pass +#![allow(unused_imports)] +// pretty-expanded FIXME #23616 + +#[macro_use] extern crate std as std2; + +fn main() {} diff --git a/tests/ui/issues/issue-14344.rs b/tests/ui/issues/issue-14344.rs new file mode 100644 index 000000000..33b1df827 --- /dev/null +++ b/tests/ui/issues/issue-14344.rs @@ -0,0 +1,11 @@ +// 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(); +} diff --git a/tests/ui/issues/issue-14366.rs b/tests/ui/issues/issue-14366.rs new file mode 100644 index 000000000..bb338860d --- /dev/null +++ b/tests/ui/issues/issue-14366.rs @@ -0,0 +1,4 @@ +fn main() { + let _x = "test" as &dyn (::std::any::Any); + //~^ ERROR the size for values of type +} diff --git a/tests/ui/issues/issue-14366.stderr b/tests/ui/issues/issue-14366.stderr new file mode 100644 index 000000000..10a73b245 --- /dev/null +++ b/tests/ui/issues/issue-14366.stderr @@ -0,0 +1,16 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/issue-14366.rs:2:14 + | +LL | let _x = "test" as &dyn (::std::any::Any); + | ^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: required for the cast from `str` to the object type `dyn Any` +help: consider borrowing the value, since `&str` can be coerced into `dyn Any` + | +LL | let _x = &"test" as &dyn (::std::any::Any); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-14382.rs b/tests/ui/issues/issue-14382.rs new file mode 100644 index 000000000..dca24d0be --- /dev/null +++ b/tests/ui/issues/issue-14382.rs @@ -0,0 +1,15 @@ +// run-pass +#[derive(Debug)] +struct Matrix4<S>(#[allow(unused_tuple_struct_fields)] S); +trait POrd<S> {} + +fn translate<S: POrd<S>>(s: S) -> Matrix4<S> { Matrix4(s) } + +impl POrd<f32> for f32 {} +impl POrd<f64> for f64 {} + +fn main() { + let x = 1.0; + let m : Matrix4<f32> = translate(x); + println!("m: {:?}", m); +} diff --git a/tests/ui/issues/issue-14393.rs b/tests/ui/issues/issue-14393.rs new file mode 100644 index 000000000..df635407a --- /dev/null +++ b/tests/ui/issues/issue-14393.rs @@ -0,0 +1,10 @@ +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + match ("", 1_usize) { + (_, 42_usize) => (), + ("", _) => (), + _ => () + } +} diff --git a/tests/ui/issues/issue-14399.rs b/tests/ui/issues/issue-14399.rs new file mode 100644 index 000000000..7b32bf8e4 --- /dev/null +++ b/tests/ui/issues/issue-14399.rs @@ -0,0 +1,18 @@ +// run-pass +// #14399 +// We'd previously ICE if we had a method call whose return +// value was coerced to a trait object. (v.clone() returns Box<B1> +// which is coerced to Box<A>). + +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +struct B1; + +trait A { fn foo(&self) {} } +impl A for B1 {} + +fn main() { + let v: Box<_> = Box::new(B1); + let _c: Box<dyn A> = v.clone(); +} diff --git a/tests/ui/issues/issue-14421.rs b/tests/ui/issues/issue-14421.rs new file mode 100644 index 000000000..c59bd8706 --- /dev/null +++ b/tests/ui/issues/issue-14421.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(non_snake_case)] + +// aux-build:issue-14421.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_14421 as bug_lib; + +use bug_lib::B; +use bug_lib::make; + +pub fn main() { + let mut an_A: B = make(); + an_A.foo(); +} diff --git a/tests/ui/issues/issue-14422.rs b/tests/ui/issues/issue-14422.rs new file mode 100644 index 000000000..b9e2065d0 --- /dev/null +++ b/tests/ui/issues/issue-14422.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(non_snake_case)] + +// aux-build:issue-14422.rs + +// pretty-expanded FIXME #23616 + +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(); +} diff --git a/tests/ui/issues/issue-1448-2.rs b/tests/ui/issues/issue-1448-2.rs new file mode 100644 index 000000000..829e81b9c --- /dev/null +++ b/tests/ui/issues/issue-1448-2.rs @@ -0,0 +1,7 @@ +// Regression test for issue #1448 and #1386 + +fn foo(a: u32) -> u32 { a } + +fn main() { + println!("{}", foo(10i32)); //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-1448-2.stderr b/tests/ui/issues/issue-1448-2.stderr new file mode 100644 index 000000000..203dd92c9 --- /dev/null +++ b/tests/ui/issues/issue-1448-2.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-1448-2.rs:6:24 + | +LL | println!("{}", foo(10i32)); + | --- ^^^^^ expected `u32`, found `i32` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-1448-2.rs:3:4 + | +LL | fn foo(a: u32) -> u32 { a } + | ^^^ ------ +help: change the type of the numeric literal from `i32` to `u32` + | +LL | println!("{}", foo(10u32)); + | ~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-1451.rs b/tests/ui/issues/issue-1451.rs new file mode 100644 index 000000000..ad8928b20 --- /dev/null +++ b/tests/ui/issues/issue-1451.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 +#![allow(non_snake_case)] +#![allow(unused_variables)] + +struct T { f: extern "Rust" fn() } +struct S { f: extern "Rust" fn() } + +fn fooS(t: S) { +} + +fn fooT(t: T) { +} + +fn bar() { +} + +pub fn main() { + let x: extern "Rust" fn() = bar; + fooS(S {f: x}); + fooS(S {f: bar}); + + let x: extern "Rust" fn() = bar; + fooT(T {f: x}); + fooT(T {f: bar}); +} diff --git a/tests/ui/issues/issue-14541.rs b/tests/ui/issues/issue-14541.rs new file mode 100644 index 000000000..555ec9f98 --- /dev/null +++ b/tests/ui/issues/issue-14541.rs @@ -0,0 +1,10 @@ +struct Vec2 { y: f32 } +struct Vec3 { y: f32, z: f32 } + +fn make(v: Vec2) { + let Vec3 { y: _, z: _ } = v; + //~^ ERROR mismatched types + //~| expected struct `Vec2`, found struct `Vec3` +} + +fn main() { } diff --git a/tests/ui/issues/issue-14541.stderr b/tests/ui/issues/issue-14541.stderr new file mode 100644 index 000000000..cf155f428 --- /dev/null +++ b/tests/ui/issues/issue-14541.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/issue-14541.rs:5:9 + | +LL | let Vec3 { y: _, z: _ } = v; + | ^^^^^^^^^^^^^^^^^^^ - this expression has type `Vec2` + | | + | expected struct `Vec2`, found struct `Vec3` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-1460.rs b/tests/ui/issues/issue-1460.rs new file mode 100644 index 000000000..e663f7fd4 --- /dev/null +++ b/tests/ui/issues/issue-1460.rs @@ -0,0 +1,7 @@ +// run-pass + +// pretty-expanded FIXME #23616 + +pub fn main() { + {|i: u32| if 1 == i { }}; //~ WARN unused closure that must be used +} diff --git a/tests/ui/issues/issue-1460.stderr b/tests/ui/issues/issue-1460.stderr new file mode 100644 index 000000000..eb7661fad --- /dev/null +++ b/tests/ui/issues/issue-1460.stderr @@ -0,0 +1,11 @@ +warning: unused closure that must be used + --> $DIR/issue-1460.rs:6:5 + | +LL | {|i: u32| if 1 == i { }}; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: closures are lazy and do nothing unless called + = note: `#[warn(unused_must_use)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/issues/issue-14721.rs b/tests/ui/issues/issue-14721.rs new file mode 100644 index 000000000..a5c47dd8c --- /dev/null +++ b/tests/ui/issues/issue-14721.rs @@ -0,0 +1,4 @@ +fn main() { + let foo = "str"; + println!("{}", foo.desc); //~ no field `desc` on type `&str` +} diff --git a/tests/ui/issues/issue-14721.stderr b/tests/ui/issues/issue-14721.stderr new file mode 100644 index 000000000..49ebb2976 --- /dev/null +++ b/tests/ui/issues/issue-14721.stderr @@ -0,0 +1,9 @@ +error[E0609]: no field `desc` on type `&str` + --> $DIR/issue-14721.rs:3:24 + | +LL | println!("{}", foo.desc); + | ^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-1476.rs b/tests/ui/issues/issue-1476.rs new file mode 100644 index 000000000..138570a93 --- /dev/null +++ b/tests/ui/issues/issue-1476.rs @@ -0,0 +1,3 @@ +fn main() { + println!("{}", x); //~ ERROR cannot find value `x` in this scope +} diff --git a/tests/ui/issues/issue-1476.stderr b/tests/ui/issues/issue-1476.stderr new file mode 100644 index 000000000..670bd5463 --- /dev/null +++ b/tests/ui/issues/issue-1476.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `x` in this scope + --> $DIR/issue-1476.rs:2:20 + | +LL | println!("{}", x); + | ^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/issues/issue-14821.rs b/tests/ui/issues/issue-14821.rs new file mode 100644 index 000000000..00b2e3607 --- /dev/null +++ b/tests/ui/issues/issue-14821.rs @@ -0,0 +1,21 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +trait SomeTrait {} +struct Meow; +impl SomeTrait for Meow {} + +struct Foo<'a> { + x: &'a dyn SomeTrait, + y: &'a dyn SomeTrait, +} + +impl<'a> Foo<'a> { + pub fn new<'b>(x: &'b dyn SomeTrait, y: &'b dyn SomeTrait) -> Foo<'b> { Foo { x: x, y: y } } +} + +fn main() { + let r = Meow; + let s = Meow; + let q = Foo::new(&r as &dyn SomeTrait, &s as &dyn SomeTrait); +} diff --git a/tests/ui/issues/issue-14845.rs b/tests/ui/issues/issue-14845.rs new file mode 100644 index 000000000..d9b20e1f6 --- /dev/null +++ b/tests/ui/issues/issue-14845.rs @@ -0,0 +1,11 @@ +struct X { + a: [u8; 1] +} + +fn main() { + let x = X { a: [0] }; + let _f = &x.a as *mut u8; //~ ERROR casting + + let local: [u8; 1] = [0]; + let _v = &local as *mut u8; //~ ERROR casting +} diff --git a/tests/ui/issues/issue-14845.stderr b/tests/ui/issues/issue-14845.stderr new file mode 100644 index 000000000..2fa9fbaa8 --- /dev/null +++ b/tests/ui/issues/issue-14845.stderr @@ -0,0 +1,15 @@ +error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid + --> $DIR/issue-14845.rs:7:14 + | +LL | let _f = &x.a as *mut u8; + | ^^^^^^^^^^^^^^^ + +error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid + --> $DIR/issue-14845.rs:10:14 + | +LL | let _v = &local as *mut u8; + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0606`. diff --git a/tests/ui/issues/issue-14853.rs b/tests/ui/issues/issue-14853.rs new file mode 100644 index 000000000..4ce6e3174 --- /dev/null +++ b/tests/ui/issues/issue-14853.rs @@ -0,0 +1,20 @@ +use std::fmt::Debug; + +trait Str {} + +trait Something: Sized { + fn yay<T: Debug>(_: Option<Self>, thing: &[T]); +} + +struct X { data: u32 } + +impl Something for X { + fn yay<T: Str>(_:Option<X>, thing: &[T]) { + //~^ ERROR E0276 + } +} + +fn main() { + let arr = &["one", "two", "three"]; + println!("{:?}", Something::yay(None::<X>, arr)); +} diff --git a/tests/ui/issues/issue-14853.stderr b/tests/ui/issues/issue-14853.stderr new file mode 100644 index 000000000..2adcf55ec --- /dev/null +++ b/tests/ui/issues/issue-14853.stderr @@ -0,0 +1,12 @@ +error[E0276]: impl has stricter requirements than trait + --> $DIR/issue-14853.rs:12:15 + | +LL | fn yay<T: Debug>(_: Option<Self>, thing: &[T]); + | ----------------------------------------------- definition of `yay` from trait +... +LL | fn yay<T: Str>(_:Option<X>, thing: &[T]) { + | ^^^ impl has extra requirement `T: Str` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0276`. diff --git a/tests/ui/issues/issue-14865.rs b/tests/ui/issues/issue-14865.rs new file mode 100644 index 000000000..56e78e78f --- /dev/null +++ b/tests/ui/issues/issue-14865.rs @@ -0,0 +1,23 @@ +// run-pass +#![allow(dead_code)] + +enum X { + Foo(usize), + Bar(bool) +} + +fn main() { + let x = match X::Foo(42) { + X::Foo(..) => 1, + _ if true => 0, + X::Bar(..) => panic!("Oh dear") + }; + assert_eq!(x, 1); + + let x = match X::Foo(42) { + _ if true => 0, + X::Foo(..) => 1, + X::Bar(..) => panic!("Oh dear") + }; + assert_eq!(x, 0); +} diff --git a/tests/ui/issues/issue-14875.rs b/tests/ui/issues/issue-14875.rs new file mode 100644 index 000000000..fca330915 --- /dev/null +++ b/tests/ui/issues/issue-14875.rs @@ -0,0 +1,35 @@ +// run-pass +// needs-unwind + +// Check that values are not leaked when a dtor panics (#14875) + +use std::panic::{self, UnwindSafe}; + +struct SetInnerOnDrop<'a>(&'a mut bool); + +impl<'a> UnwindSafe for SetInnerOnDrop<'a> {} + +impl<'a> Drop for SetInnerOnDrop<'a> { + fn drop(&mut self) { + *self.0 = true; + } +} + +struct PanicOnDrop; +impl Drop for PanicOnDrop { + fn drop(&mut self) { + panic!("test panic"); + } +} + +fn main() { + let mut set_on_drop = false; + { + let set_inner_on_drop = SetInnerOnDrop(&mut set_on_drop); + let _ = panic::catch_unwind(|| { + let _set_inner_on_drop = set_inner_on_drop; + let _panic_on_drop = PanicOnDrop; + }); + } + assert!(set_on_drop); +} diff --git a/tests/ui/issues/issue-14901.rs b/tests/ui/issues/issue-14901.rs new file mode 100644 index 000000000..5319abbdf --- /dev/null +++ b/tests/ui/issues/issue-14901.rs @@ -0,0 +1,18 @@ +// check-pass +pub trait Reader {} + +enum Wrapper<'a> { + WrapReader(&'a (dyn Reader + 'a)) +} + +trait Wrap<'a> { + fn wrap(self) -> Wrapper<'a>; +} + +impl<'a, R: Reader> Wrap<'a> for &'a mut R { + fn wrap(self) -> Wrapper<'a> { + Wrapper::WrapReader(self as &'a mut dyn Reader) + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-14915.rs b/tests/ui/issues/issue-14915.rs new file mode 100644 index 000000000..127b909dd --- /dev/null +++ b/tests/ui/issues/issue-14915.rs @@ -0,0 +1,6 @@ +fn main() { + let x: Box<isize> = Box::new(0); + + println!("{}", x + 1); + //~^ ERROR cannot add `{integer}` to `Box<isize>` +} diff --git a/tests/ui/issues/issue-14915.stderr b/tests/ui/issues/issue-14915.stderr new file mode 100644 index 000000000..6e6326929 --- /dev/null +++ b/tests/ui/issues/issue-14915.stderr @@ -0,0 +1,11 @@ +error[E0369]: cannot add `{integer}` to `Box<isize>` + --> $DIR/issue-14915.rs:4:22 + | +LL | println!("{}", x + 1); + | - ^ - {integer} + | | + | Box<isize> + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-14919.rs b/tests/ui/issues/issue-14919.rs new file mode 100644 index 000000000..943615433 --- /dev/null +++ b/tests/ui/issues/issue-14919.rs @@ -0,0 +1,55 @@ +// run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait Matcher { + fn next_match(&mut self) -> Option<(usize, usize)>; +} + +struct CharPredMatcher<'a, 'b> { + str: &'a str, + pred: Box<dyn FnMut(char) -> bool + 'b>, +} + +impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> { + fn next_match(&mut self) -> Option<(usize, usize)> { + None + } +} + +trait IntoMatcher<'a, T> { + fn into_matcher(self, _: &'a str) -> T; +} + +impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b { + fn into_matcher(self, s: &'a str) -> CharPredMatcher<'a, 'b> { + CharPredMatcher { + str: s, + pred: Box::new(self), + } + } +} + +struct MatchIndices<M> { + matcher: M +} + +impl<M: Matcher> Iterator for MatchIndices<M> { + type Item = (usize, usize); + + fn next(&mut self) -> Option<(usize, usize)> { + self.matcher.next_match() + } +} + +fn match_indices<'a, M, T: IntoMatcher<'a, M>>(s: &'a str, from: T) -> MatchIndices<M> { + let string_matcher = from.into_matcher(s); + MatchIndices { matcher: string_matcher } +} + +fn main() { + let s = "abcbdef"; + match_indices(s, |c: char| c == 'b') + .collect::<Vec<_>>(); +} diff --git a/tests/ui/issues/issue-14959.rs b/tests/ui/issues/issue-14959.rs new file mode 100644 index 000000000..e31a94315 --- /dev/null +++ b/tests/ui/issues/issue-14959.rs @@ -0,0 +1,55 @@ +// check-pass +// pretty-expanded FIXME #23616 + +#![feature(fn_traits, unboxed_closures)] + +use std::ops::Fn; + +trait Response { fn dummy(&self) { } } +trait Request { fn dummy(&self) { } } +trait Ingot<R, S> { + fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status; +} + +#[allow(dead_code)] +struct HelloWorld; + +struct SendFile; +struct Alloy; +enum Status { + Continue +} + +impl Alloy { + fn find<T>(&self) -> Option<T> { + None + } +} + +impl<'b> Fn<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call(&self, (_res,): (&'b mut (dyn Response + 'b),)) {} +} + +impl<'b> FnMut<(&'b mut (dyn Response + 'b),)> for SendFile { + extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (dyn Response+'b),)) { + self.call((_res,)) + } +} + +impl<'b> FnOnce<(&'b mut (dyn Response + 'b),)> for SendFile { + type Output = (); + + extern "rust-call" fn call_once(self, (_res,): (&'b mut (dyn Response+'b),)) { + self.call((_res,)) + } +} + +impl<Rq: Request, Rs: Response> Ingot<Rq, Rs> for HelloWorld { + fn enter(&mut self, _req: &mut Rq, res: &mut Rs, alloy: &mut Alloy) -> Status { + let send_file = alloy.find::<SendFile>().unwrap(); + send_file(res); + Status::Continue + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-15034.rs b/tests/ui/issues/issue-15034.rs new file mode 100644 index 000000000..9ea6ed89c --- /dev/null +++ b/tests/ui/issues/issue-15034.rs @@ -0,0 +1,22 @@ +pub struct Lexer<'a> { + input: &'a str, +} + +impl<'a> Lexer<'a> { + pub fn new(input: &'a str) -> Lexer<'a> { + Lexer { input: input } + } +} + +struct Parser<'a> { + lexer: &'a mut Lexer<'a>, +} + +impl<'a> Parser<'a> { + pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { + Parser { lexer: lexer } + //~^ ERROR explicit lifetime required in the type of `lexer` [E0621] + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-15034.stderr b/tests/ui/issues/issue-15034.stderr new file mode 100644 index 000000000..f142e260a --- /dev/null +++ b/tests/ui/issues/issue-15034.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `lexer` + --> $DIR/issue-15034.rs:17:9 + | +LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { + | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>` +LL | Parser { lexer: lexer } + | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/issues/issue-15043.rs b/tests/ui/issues/issue-15043.rs new file mode 100644 index 000000000..53748be8a --- /dev/null +++ b/tests/ui/issues/issue-15043.rs @@ -0,0 +1,14 @@ +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(warnings)] + +struct S<T>(T); + +static s1: S<S<usize>>=S(S(0)); +static s2: S<usize>=S(0); + +fn main() { + let foo: S<S<usize>>=S(S(0)); + let foo: S<usize>=S(0); +} diff --git a/tests/ui/issues/issue-15063.rs b/tests/ui/issues/issue-15063.rs new file mode 100644 index 000000000..408267512 --- /dev/null +++ b/tests/ui/issues/issue-15063.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +enum Two { A, B} +impl Drop for Two { + fn drop(&mut self) { + println!("Dropping!"); + } +} +fn main() { + let k = Two::A; +} diff --git a/tests/ui/issues/issue-15094.rs b/tests/ui/issues/issue-15094.rs new file mode 100644 index 000000000..cb27e2bcf --- /dev/null +++ b/tests/ui/issues/issue-15094.rs @@ -0,0 +1,26 @@ +#![feature(fn_traits, unboxed_closures)] + +use std::{fmt, ops}; + +struct Debuger<T> { + x: T +} + +impl<T: fmt::Debug> ops::FnOnce<(),> for Debuger<T> { + type Output = (); + fn call_once(self, _args: ()) { + //~^ ERROR `call_once` has an incompatible type for trait + //~| expected signature `extern "rust-call" fn + //~| found signature `fn + println!("{:?}", self.x); + } +} + +fn make_shower<T>(x: T) -> Debuger<T> { + Debuger { x: x } +} + +pub fn main() { + let show3 = make_shower(3); + show3(); +} diff --git a/tests/ui/issues/issue-15094.stderr b/tests/ui/issues/issue-15094.stderr new file mode 100644 index 000000000..b7c950892 --- /dev/null +++ b/tests/ui/issues/issue-15094.stderr @@ -0,0 +1,12 @@ +error[E0053]: method `call_once` has an incompatible type for trait + --> $DIR/issue-15094.rs:11:5 + | +LL | fn call_once(self, _args: ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "rust-call" fn, found "Rust" fn + | + = note: expected signature `extern "rust-call" fn(Debuger<_>, ())` + found signature `fn(Debuger<_>, ())` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/issues/issue-15104.rs b/tests/ui/issues/issue-15104.rs new file mode 100644 index 000000000..47b207ea9 --- /dev/null +++ b/tests/ui/issues/issue-15104.rs @@ -0,0 +1,13 @@ +// run-pass + +fn main() { + assert_eq!(count_members(&[1, 2, 3, 4]), 4); +} + +fn count_members(v: &[usize]) -> usize { + match *v { + [] => 0, + [_] => 1, + [_, ref xs @ ..] => 1 + count_members(xs) + } +} diff --git a/tests/ui/issues/issue-15129-rpass.rs b/tests/ui/issues/issue-15129-rpass.rs new file mode 100644 index 000000000..522d0209c --- /dev/null +++ b/tests/ui/issues/issue-15129-rpass.rs @@ -0,0 +1,25 @@ +// run-pass + +pub enum T { + T1(()), + T2(()) +} + +pub enum V { + V1(isize), + V2(bool) +} + +fn foo(x: (T, V)) -> String { + match x { + (T::T1(()), V::V1(i)) => format!("T1(()), V1({})", i), + (T::T2(()), V::V2(b)) => format!("T2(()), V2({})", b), + _ => String::new() + } +} + + +fn main() { + assert_eq!(foo((T::T1(()), V::V1(99))), "T1(()), V1(99)".to_string()); + assert_eq!(foo((T::T2(()), V::V2(true))), "T2(()), V2(true)".to_string()); +} diff --git a/tests/ui/issues/issue-15155.rs b/tests/ui/issues/issue-15155.rs new file mode 100644 index 000000000..7b137b4af --- /dev/null +++ b/tests/ui/issues/issue-15155.rs @@ -0,0 +1,21 @@ +// run-pass +trait TraitWithSend: Send {} +trait IndirectTraitWithSend: TraitWithSend {} + +// Check struct instantiation (Box<TraitWithSend> will only have Send if TraitWithSend has Send) +#[allow(dead_code)] +struct Blah { x: Box<dyn TraitWithSend> } +impl TraitWithSend for Blah {} + +// Struct instantiation 2-levels deep +#[allow(dead_code)] +struct IndirectBlah { x: Box<dyn IndirectTraitWithSend> } +impl TraitWithSend for IndirectBlah {} +impl IndirectTraitWithSend for IndirectBlah {} + +fn test_trait<T: Send + ?Sized>() { println!("got here!") } + +fn main() { + test_trait::<dyn TraitWithSend>(); + test_trait::<dyn IndirectTraitWithSend>(); +} diff --git a/tests/ui/issues/issue-15167.rs b/tests/ui/issues/issue-15167.rs new file mode 100644 index 000000000..a2653c10e --- /dev/null +++ b/tests/ui/issues/issue-15167.rs @@ -0,0 +1,26 @@ +// macro f should not be able to inject a reference to 'n'. + +macro_rules! f { () => (n) } +//~^ ERROR cannot find value `n` in this scope +//~| ERROR cannot find value `n` in this scope +//~| ERROR cannot find value `n` in this scope +//~| ERROR cannot find value `n` in this scope + +fn main() -> (){ + for n in 0..1 { + println!("{}", f!()); + } + + if let Some(n) = None { + println!("{}", f!()); + } + + if false { + } else if let Some(n) = None { + println!("{}", f!()); + } + + while let Some(n) = None { + println!("{}", f!()); + } +} diff --git a/tests/ui/issues/issue-15167.stderr b/tests/ui/issues/issue-15167.stderr new file mode 100644 index 000000000..53082ea0e --- /dev/null +++ b/tests/ui/issues/issue-15167.stderr @@ -0,0 +1,47 @@ +error[E0425]: cannot find value `n` in this scope + --> $DIR/issue-15167.rs:3:25 + | +LL | macro_rules! f { () => (n) } + | ^ not found in this scope +... +LL | println!("{}", f!()); + | ---- in this macro invocation + | + = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0425]: cannot find value `n` in this scope + --> $DIR/issue-15167.rs:3:25 + | +LL | macro_rules! f { () => (n) } + | ^ not found in this scope +... +LL | println!("{}", f!()); + | ---- in this macro invocation + | + = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0425]: cannot find value `n` in this scope + --> $DIR/issue-15167.rs:3:25 + | +LL | macro_rules! f { () => (n) } + | ^ not found in this scope +... +LL | println!("{}", f!()); + | ---- in this macro invocation + | + = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0425]: cannot find value `n` in this scope + --> $DIR/issue-15167.rs:3:25 + | +LL | macro_rules! f { () => (n) } + | ^ not found in this scope +... +LL | println!("{}", f!()); + | ---- in this macro invocation + | + = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/issues/issue-15189.rs b/tests/ui/issues/issue-15189.rs new file mode 100644 index 000000000..a9c884bdc --- /dev/null +++ b/tests/ui/issues/issue-15189.rs @@ -0,0 +1,10 @@ +// run-pass +macro_rules! third { + ($e:expr) => ({let x = 2; $e[x]}) +} + +fn main() { + let x = vec![10_usize,11_usize,12_usize,13_usize]; + let t = third!(x); + assert_eq!(t,12_usize); +} diff --git a/tests/ui/issues/issue-15207.rs b/tests/ui/issues/issue-15207.rs new file mode 100644 index 000000000..356e55ac9 --- /dev/null +++ b/tests/ui/issues/issue-15207.rs @@ -0,0 +1,6 @@ +fn main() { + loop { + break.push(1) //~ ERROR no method named `push` found for type `!` + ; + } +} diff --git a/tests/ui/issues/issue-15207.stderr b/tests/ui/issues/issue-15207.stderr new file mode 100644 index 000000000..25ce7cb5c --- /dev/null +++ b/tests/ui/issues/issue-15207.stderr @@ -0,0 +1,9 @@ +error[E0599]: no method named `push` found for type `!` in the current scope + --> $DIR/issue-15207.rs:3:15 + | +LL | break.push(1) + | ^^^^ method not found in `!` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-15260.rs b/tests/ui/issues/issue-15260.rs new file mode 100644 index 000000000..64fc3df3d --- /dev/null +++ b/tests/ui/issues/issue-15260.rs @@ -0,0 +1,25 @@ +struct Foo { + a: usize, +} + +fn main() { + let Foo { + a: _, + a: _ + //~^ ERROR field `a` bound multiple times in the pattern + } = Foo { a: 29 }; + + let Foo { + a, + a: _ + //~^ ERROR field `a` bound multiple times in the pattern + } = Foo { a: 29 }; + + let Foo { + a, + a: _, + //~^ ERROR field `a` bound multiple times in the pattern + a: x + //~^ ERROR field `a` bound multiple times in the pattern + } = Foo { a: 29 }; +} diff --git a/tests/ui/issues/issue-15260.stderr b/tests/ui/issues/issue-15260.stderr new file mode 100644 index 000000000..4a3041122 --- /dev/null +++ b/tests/ui/issues/issue-15260.stderr @@ -0,0 +1,36 @@ +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:8:9 + | +LL | a: _, + | ---- first use of `a` +LL | a: _ + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:14:9 + | +LL | a, + | - first use of `a` +LL | a: _ + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:20:9 + | +LL | a, + | - first use of `a` +LL | a: _, + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:22:9 + | +LL | a, + | - first use of `a` +... +LL | a: x + | ^^^^ multiple uses of `a` in pattern + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0025`. diff --git a/tests/ui/issues/issue-15381.rs b/tests/ui/issues/issue-15381.rs new file mode 100644 index 000000000..23b266bef --- /dev/null +++ b/tests/ui/issues/issue-15381.rs @@ -0,0 +1,9 @@ +fn main() { + let values: Vec<u8> = vec![1,2,3,4,5,6,7,8]; + + for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { + //~^ ERROR refutable pattern in `for` loop binding + //~| patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered + println!("y={}", y); + } +} diff --git a/tests/ui/issues/issue-15381.stderr b/tests/ui/issues/issue-15381.stderr new file mode 100644 index 000000000..085958411 --- /dev/null +++ b/tests/ui/issues/issue-15381.stderr @@ -0,0 +1,11 @@ +error[E0005]: refutable pattern in `for` loop binding + --> $DIR/issue-15381.rs:4:9 + | +LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { + | ^^^^^^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered + | + = note: the matched value is of type `&[u8]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0005`. diff --git a/tests/ui/issues/issue-15444.rs b/tests/ui/issues/issue-15444.rs new file mode 100644 index 000000000..e94afee96 --- /dev/null +++ b/tests/ui/issues/issue-15444.rs @@ -0,0 +1,23 @@ +// run-pass +// pretty-expanded FIXME #23616 + +trait MyTrait { + fn foo(&self); +} + +impl<A, B, C> MyTrait for fn(A, B) -> C { + fn foo(&self) {} +} + +fn bar<T: MyTrait>(t: &T) { + t.foo() +} + +fn thing(a: isize, b: isize) -> isize { + a + b +} + +fn main() { + let thing: fn(isize, isize) -> isize = thing; // coerce to fn type + bar(&thing); +} diff --git a/tests/ui/issues/issue-15523-big.rs b/tests/ui/issues/issue-15523-big.rs new file mode 100644 index 000000000..05414f1db --- /dev/null +++ b/tests/ui/issues/issue-15523-big.rs @@ -0,0 +1,39 @@ +// run-pass +// Issue 15523: derive(PartialOrd) should use the provided +// discriminant values for the derived ordering. +// +// This test is checking corner cases that arise when you have +// 64-bit values in the variants. + +#[derive(PartialEq, PartialOrd)] +#[repr(u64)] +enum Eu64 { + Pos2 = 2, + PosMax = !0, + Pos1 = 1, +} + +#[derive(PartialEq, PartialOrd)] +#[repr(i64)] +enum Ei64 { + Pos2 = 2, + Neg1 = -1, + NegMin = 1 << 63, + PosMax = !(1 << 63), + Pos1 = 1, +} + +fn main() { + assert!(Eu64::Pos2 > Eu64::Pos1); + assert!(Eu64::Pos2 < Eu64::PosMax); + assert!(Eu64::Pos1 < Eu64::PosMax); + + + assert!(Ei64::Pos2 > Ei64::Pos1); + assert!(Ei64::Pos2 > Ei64::Neg1); + assert!(Ei64::Pos1 > Ei64::Neg1); + assert!(Ei64::Pos2 > Ei64::NegMin); + assert!(Ei64::Pos1 > Ei64::NegMin); + assert!(Ei64::Pos2 < Ei64::PosMax); + assert!(Ei64::Pos1 < Ei64::PosMax); +} diff --git a/tests/ui/issues/issue-15523.rs b/tests/ui/issues/issue-15523.rs new file mode 100644 index 000000000..220a34b9b --- /dev/null +++ b/tests/ui/issues/issue-15523.rs @@ -0,0 +1,42 @@ +// run-pass +// Issue 15523: derive(PartialOrd) should use the provided +// discriminant values for the derived ordering. +// +// This is checking the basic functionality. + +#[derive(PartialEq, PartialOrd)] +enum E1 { + Pos2 = 2, + Neg1 = -1, + Pos1 = 1, +} + +#[derive(PartialEq, PartialOrd)] +#[repr(u8)] +enum E2 { + Pos2 = 2, + PosMax = !0 as u8, + Pos1 = 1, +} + +#[derive(PartialEq, PartialOrd)] +#[repr(i8)] +enum E3 { + Pos2 = 2, + Neg1 = -1_i8, + Pos1 = 1, +} + +fn main() { + assert!(E1::Pos2 > E1::Pos1); + assert!(E1::Pos1 > E1::Neg1); + assert!(E1::Pos2 > E1::Neg1); + + assert!(E2::Pos2 > E2::Pos1); + assert!(E2::Pos1 < E2::PosMax); + assert!(E2::Pos2 < E2::PosMax); + + assert!(E3::Pos2 > E3::Pos1); + assert!(E3::Pos1 > E3::Neg1); + assert!(E3::Pos2 > E3::Neg1); +} diff --git a/tests/ui/issues/issue-15562.rs b/tests/ui/issues/issue-15562.rs new file mode 100644 index 000000000..dc0ecd365 --- /dev/null +++ b/tests/ui/issues/issue-15562.rs @@ -0,0 +1,19 @@ +// run-pass +// aux-build:issue-15562.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_15562 as i; + +pub fn main() { + unsafe { + transmute(); + i::transmute(); + } +} + +// We declare this so we don't run into unresolved symbol errors +// The above extern is NOT `extern "rust-intrinsic"` and thus +// means it'll try to find a corresponding symbol to link to. +#[no_mangle] +pub extern "C" fn transmute() {} diff --git a/tests/ui/issues/issue-15571.rs b/tests/ui/issues/issue-15571.rs new file mode 100644 index 000000000..5f228b286 --- /dev/null +++ b/tests/ui/issues/issue-15571.rs @@ -0,0 +1,57 @@ +// run-pass + +fn match_on_local() { + let mut foo: Option<Box<_>> = Some(Box::new(5)); + match foo { + None => {}, + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); +} + +fn match_on_arg(mut foo: Option<Box<i32>>) { + match foo { + None => {} + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); +} + +fn match_on_binding() { + match Some(Box::new(7)) { + mut foo => { + match foo { + None => {}, + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); + } + } +} + +fn match_on_upvar() { + let mut foo: Option<Box<_>> = Some(Box::new(8)); + let f = move|| { + match foo { + None => {}, + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); + }; + f(); +} + +fn main() { + match_on_local(); + match_on_arg(Some(Box::new(6))); + match_on_binding(); + match_on_upvar(); +} diff --git a/tests/ui/issues/issue-15673.rs b/tests/ui/issues/issue-15673.rs new file mode 100644 index 000000000..a8733d7f1 --- /dev/null +++ b/tests/ui/issues/issue-15673.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(stable_features)] + +#![feature(iter_arith)] + +fn main() { + let x: [u64; 3] = [1, 2, 3]; + assert_eq!(6, (0..3).map(|i| x[i]).sum::<u64>()); +} diff --git a/tests/ui/issues/issue-15689-1.rs b/tests/ui/issues/issue-15689-1.rs new file mode 100644 index 000000000..d143926b2 --- /dev/null +++ b/tests/ui/issues/issue-15689-1.rs @@ -0,0 +1,10 @@ +// run-pass + +#[derive(PartialEq, Debug)] +enum Test<'a> { + Slice(&'a isize) +} + +fn main() { + assert_eq!(Test::Slice(&1), Test::Slice(&1)) +} diff --git a/tests/ui/issues/issue-15689-2.rs b/tests/ui/issues/issue-15689-2.rs new file mode 100644 index 000000000..83dcb1406 --- /dev/null +++ b/tests/ui/issues/issue-15689-2.rs @@ -0,0 +1,10 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +enum Test<'a> { + Slice(&'a isize) +} + +fn main() {} diff --git a/tests/ui/issues/issue-15734.rs b/tests/ui/issues/issue-15734.rs new file mode 100644 index 000000000..be5820606 --- /dev/null +++ b/tests/ui/issues/issue-15734.rs @@ -0,0 +1,58 @@ +// run-pass +// If `Index` used an associated type for its output, this test would +// work more smoothly. + +use std::ops::Index; + +struct Mat<T> { data: Vec<T>, cols: usize, } + +impl<T> Mat<T> { + fn new(data: Vec<T>, cols: usize) -> Mat<T> { + Mat { data: data, cols: cols } + } + fn row<'a>(&'a self, row: usize) -> Row<&'a Mat<T>> { + Row { mat: self, row: row, } + } +} + +impl<T> Index<(usize, usize)> for Mat<T> { + type Output = T; + + fn index<'a>(&'a self, (row, col): (usize, usize)) -> &'a T { + &self.data[row * self.cols + col] + } +} + +impl<'a, T> Index<(usize, usize)> for &'a Mat<T> { + type Output = T; + + fn index<'b>(&'b self, index: (usize, usize)) -> &'b T { + (*self).index(index) + } +} + +struct Row<M> { mat: M, row: usize, } + +impl<T, M: Index<(usize, usize), Output=T>> Index<usize> for Row<M> { + type Output = T; + + fn index<'a>(&'a self, col: usize) -> &'a T { + &self.mat[(self.row, col)] + } +} + +fn main() { + let m = Mat::new(vec![1, 2, 3, 4, 5, 6], 3); + let r = m.row(1); + + assert_eq!(r.index(2), &6); + assert_eq!(r[2], 6); + assert_eq!(r[2], 6); + assert_eq!(6, r[2]); + + let e = r[2]; + assert_eq!(e, 6); + + let e: usize = r[2]; + assert_eq!(e, 6); +} diff --git a/tests/ui/issues/issue-15735.rs b/tests/ui/issues/issue-15735.rs new file mode 100644 index 000000000..f9ba34405 --- /dev/null +++ b/tests/ui/issues/issue-15735.rs @@ -0,0 +1,17 @@ +// check-pass +#![allow(dead_code)] +struct A<'a> { + a: &'a i32, + b: &'a i32, +} + +impl <'a> A<'a> { + fn foo<'b>(&'b self) { + A { + a: self.a, + b: self.b, + }; + } +} + +fn main() { } diff --git a/tests/ui/issues/issue-15756.rs b/tests/ui/issues/issue-15756.rs new file mode 100644 index 000000000..e0861dee6 --- /dev/null +++ b/tests/ui/issues/issue-15756.rs @@ -0,0 +1,14 @@ +use std::slice::Chunks; +use std::slice::ChunksMut; + +fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>) +{ + for + &mut something + //~^ ERROR the size for values of type + in arg2 + { + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-15756.stderr b/tests/ui/issues/issue-15756.stderr new file mode 100644 index 000000000..d9bdc69ad --- /dev/null +++ b/tests/ui/issues/issue-15756.stderr @@ -0,0 +1,13 @@ +error[E0277]: the size for values of type `[T]` cannot be known at compilation time + --> $DIR/issue-15756.rs:7:10 + | +LL | &mut something + | ^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[T]` + = note: all local variables must have a statically known size + = help: unsized locals are gated as an unstable feature + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-15763.rs b/tests/ui/issues/issue-15763.rs new file mode 100644 index 000000000..ae0863615 --- /dev/null +++ b/tests/ui/issues/issue-15763.rs @@ -0,0 +1,88 @@ +// run-pass +#![allow(unreachable_code)] + +#[derive(PartialEq, Debug)] +struct Bar { + x: isize +} +impl Drop for Bar { + fn drop(&mut self) { + assert_eq!(self.x, 22); + } +} + +#[derive(PartialEq, Debug)] +struct Foo { + x: Bar, + a: isize +} + +fn foo() -> Result<Foo, isize> { + return Ok(Foo { + x: Bar { x: 22 }, + a: return Err(32) + }); +} + +fn baz() -> Result<Foo, isize> { + Ok(Foo { + x: Bar { x: 22 }, + a: return Err(32) + }) +} + +// explicit immediate return +fn aa() -> isize { + return 3; +} + +// implicit immediate return +fn bb() -> isize { + 3 +} + +// implicit outptr return +fn cc() -> Result<isize, isize> { + Ok(3) +} + +// explicit outptr return +fn dd() -> Result<isize, isize> { + return Ok(3); +} + +trait A { + fn aaa(&self) -> isize { + 3 + } + fn bbb(&self) -> isize { + return 3; + } + fn ccc(&self) -> Result<isize, isize> { + Ok(3) + } + fn ddd(&self) -> Result<isize, isize> { + return Ok(3); + } +} + +impl A for isize {} + +fn main() { + assert_eq!(foo(), Err(32)); + assert_eq!(baz(), Err(32)); + + assert_eq!(aa(), 3); + assert_eq!(bb(), 3); + assert_eq!(cc().unwrap(), 3); + assert_eq!(dd().unwrap(), 3); + + let i = Box::new(32isize) as Box<dyn A>; + assert_eq!(i.aaa(), 3); + let i = Box::new(32isize) as Box<dyn A>; + assert_eq!(i.bbb(), 3); + let i = Box::new(32isize) as Box<dyn A>; + assert_eq!(i.ccc().unwrap(), 3); + let i = Box::new(32isize) as Box<dyn A>; + assert_eq!(i.ddd().unwrap(), 3); +} diff --git a/tests/ui/issues/issue-15774.rs b/tests/ui/issues/issue-15774.rs new file mode 100644 index 000000000..ed2235758 --- /dev/null +++ b/tests/ui/issues/issue-15774.rs @@ -0,0 +1,25 @@ +// run-pass +// pretty-expanded FIXME #23616 + +#![deny(warnings)] +#![allow(unused_imports)] + +pub enum Foo { A } +mod bar { + pub fn normal(x: ::Foo) { + use Foo::A; + match x { + A => {} + } + } + pub fn wrong(x: ::Foo) { + match x { + ::Foo::A => {} + } + } +} + +pub fn main() { + bar::normal(Foo::A); + bar::wrong(Foo::A); +} diff --git a/tests/ui/issues/issue-15783.rs b/tests/ui/issues/issue-15783.rs new file mode 100644 index 000000000..0b1f4545e --- /dev/null +++ b/tests/ui/issues/issue-15783.rs @@ -0,0 +1,14 @@ +pub fn foo(params: Option<&[&str]>) -> usize { + params.unwrap().first().unwrap().len() +} + +fn main() { + let name = "Foo"; + let x = Some(&[name]); + let msg = foo(x); + //~^ ERROR mismatched types + //~| expected enum `Option<&[&str]>` + //~| found enum `Option<&[&str; 1]>` + //~| expected slice `[&str]`, found array `[&str; 1]` + assert_eq!(msg, 3); +} diff --git a/tests/ui/issues/issue-15783.stderr b/tests/ui/issues/issue-15783.stderr new file mode 100644 index 000000000..660dfe9ed --- /dev/null +++ b/tests/ui/issues/issue-15783.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-15783.rs:8:19 + | +LL | let msg = foo(x); + | --- ^ expected slice `[&str]`, found array `[&str; 1]` + | | + | arguments to this function are incorrect + | + = note: expected enum `Option<&[&str]>` + found enum `Option<&[&str; 1]>` +note: function defined here + --> $DIR/issue-15783.rs:1:8 + | +LL | pub fn foo(params: Option<&[&str]>) -> usize { + | ^^^ ----------------------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-15793.rs b/tests/ui/issues/issue-15793.rs new file mode 100644 index 000000000..769012b1b --- /dev/null +++ b/tests/ui/issues/issue-15793.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(dead_code)] + +enum NestedEnum { + First, + Second, + Third +} +enum Enum { + Variant1(bool), + Variant2(NestedEnum) +} + +#[inline(never)] +fn foo(x: Enum) -> isize { + match x { + Enum::Variant1(true) => 1, + Enum::Variant1(false) => 2, + Enum::Variant2(NestedEnum::Second) => 3, + Enum::Variant2(NestedEnum::Third) => 4, + Enum::Variant2(NestedEnum::First) => 5 + } +} + +fn main() { + assert_eq!(foo(Enum::Variant2(NestedEnum::Third)), 4); +} diff --git a/tests/ui/issues/issue-15858.rs b/tests/ui/issues/issue-15858.rs new file mode 100644 index 000000000..8d65afc48 --- /dev/null +++ b/tests/ui/issues/issue-15858.rs @@ -0,0 +1,33 @@ +// run-pass +static mut DROP_RAN: bool = false; + +trait Bar { + fn do_something(&mut self); +} + +struct BarImpl; + +impl Bar for BarImpl { + fn do_something(&mut self) {} +} + + +struct Foo<B: Bar>(#[allow(unused_tuple_struct_fields)] B); + +impl<B: Bar> Drop for Foo<B> { + fn drop(&mut self) { + unsafe { + DROP_RAN = true; + } + } +} + + +fn main() { + { + let _x: Foo<BarImpl> = Foo(BarImpl); + } + unsafe { + assert_eq!(DROP_RAN, true); + } +} diff --git a/tests/ui/issues/issue-15896.rs b/tests/ui/issues/issue-15896.rs new file mode 100644 index 000000000..d3153b516 --- /dev/null +++ b/tests/ui/issues/issue-15896.rs @@ -0,0 +1,15 @@ +// Regression test for #15896. It used to ICE rustc. + +fn main() { + enum R { REB(()) } + struct Tau { t: usize } + enum E { B(R, Tau) } + + let e = E::B(R::REB(()), Tau { t: 3 }); + let u = match e { + E::B( + Tau{t: x}, + //~^ ERROR mismatched types + _) => x, + }; +} diff --git a/tests/ui/issues/issue-15896.stderr b/tests/ui/issues/issue-15896.stderr new file mode 100644 index 000000000..038337f5a --- /dev/null +++ b/tests/ui/issues/issue-15896.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-15896.rs:11:11 + | +LL | let u = match e { + | - this expression has type `E` +LL | E::B( +LL | Tau{t: x}, + | ^^^^^^^^^ expected enum `R`, found struct `Tau` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-15965.rs b/tests/ui/issues/issue-15965.rs new file mode 100644 index 000000000..eef4900d4 --- /dev/null +++ b/tests/ui/issues/issue-15965.rs @@ -0,0 +1,7 @@ +fn main() { + return + { return () } +//~^ ERROR type annotations needed [E0282] + () + ; +} diff --git a/tests/ui/issues/issue-15965.stderr b/tests/ui/issues/issue-15965.stderr new file mode 100644 index 000000000..fe06810b8 --- /dev/null +++ b/tests/ui/issues/issue-15965.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-15965.rs:3:9 + | +LL | / { return () } +LL | | +LL | | () + | |______^ cannot infer type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-16048.rs b/tests/ui/issues/issue-16048.rs new file mode 100644 index 000000000..eaf6acff2 --- /dev/null +++ b/tests/ui/issues/issue-16048.rs @@ -0,0 +1,30 @@ +trait NoLifetime { + fn get<'p, T : Test<'p>>(&self) -> T; + //~^ NOTE lifetimes in impl do not match this method in trait +} + +trait Test<'p> { + fn new(buf: &'p mut [u8]) -> Self; +} + +struct Foo<'a> { + buf: &'a mut [u8], +} + +impl<'a> Test<'a> for Foo<'a> { + fn new(buf: &'a mut [u8]) -> Foo<'a> { + Foo { buf: buf } + } +} + +impl<'a> NoLifetime for Foo<'a> { + fn get<'p, T: Test<'a> + From<Foo<'a>>>(&self) -> T { + //~^ ERROR E0195 + //~| NOTE lifetimes do not match method in trait + return *self as T; + //~^ ERROR non-primitive cast: `Foo<'a>` as `T` + //~| NOTE an `as` expression can only be used to convert between primitive types + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-16048.stderr b/tests/ui/issues/issue-16048.stderr new file mode 100644 index 000000000..73610942d --- /dev/null +++ b/tests/ui/issues/issue-16048.stderr @@ -0,0 +1,21 @@ +error[E0195]: lifetime parameters or bounds on method `get` do not match the trait declaration + --> $DIR/issue-16048.rs:21:11 + | +LL | fn get<'p, T : Test<'p>>(&self) -> T; + | ------------------ lifetimes in impl do not match this method in trait +... +LL | fn get<'p, T: Test<'a> + From<Foo<'a>>>(&self) -> T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait + +error[E0605]: non-primitive cast: `Foo<'a>` as `T` + --> $DIR/issue-16048.rs:24:16 + | +LL | return *self as T; + | ^^^^^^^^^^ help: consider using the `From` trait instead: `T::from(*self)` + | + = note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0195, E0605. +For more information about an error, try `rustc --explain E0195`. diff --git a/tests/ui/issues/issue-16149.rs b/tests/ui/issues/issue-16149.rs new file mode 100644 index 000000000..51b60725c --- /dev/null +++ b/tests/ui/issues/issue-16149.rs @@ -0,0 +1,11 @@ +extern "C" { + static externalValue: isize; +} + +fn main() { + let boolValue = match 42 { + externalValue => true, + //~^ ERROR match bindings cannot shadow statics + _ => false, + }; +} diff --git a/tests/ui/issues/issue-16149.stderr b/tests/ui/issues/issue-16149.stderr new file mode 100644 index 000000000..bb809840b --- /dev/null +++ b/tests/ui/issues/issue-16149.stderr @@ -0,0 +1,12 @@ +error[E0530]: match bindings cannot shadow statics + --> $DIR/issue-16149.rs:7:9 + | +LL | static externalValue: isize; + | ---------------------------- the static `externalValue` is defined here +... +LL | externalValue => true, + | ^^^^^^^^^^^^^ cannot be named the same as a static + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0530`. diff --git a/tests/ui/issues/issue-16151.rs b/tests/ui/issues/issue-16151.rs new file mode 100644 index 000000000..48a14b2af --- /dev/null +++ b/tests/ui/issues/issue-16151.rs @@ -0,0 +1,29 @@ +// run-pass + +use std::mem; + +static mut DROP_COUNT: usize = 0; + +struct Fragment; + +impl Drop for Fragment { + fn drop(&mut self) { + unsafe { + DROP_COUNT += 1; + } + } +} + +fn main() { + { + let mut fragments = vec![Fragment, Fragment, Fragment]; + let _new_fragments: Vec<Fragment> = mem::replace(&mut fragments, vec![]) + .into_iter() + .skip_while(|_fragment| { + true + }).collect(); + } + unsafe { + assert_eq!(DROP_COUNT, 3); + } +} diff --git a/tests/ui/issues/issue-16250.rs b/tests/ui/issues/issue-16250.rs new file mode 100644 index 000000000..436e2a6ce --- /dev/null +++ b/tests/ui/issues/issue-16250.rs @@ -0,0 +1,9 @@ +#![deny(warnings)] + +pub struct Foo; + +extern "C" { + pub fn foo(x: (Foo)); //~ ERROR `extern` block uses type `Foo` +} + +fn main() {} diff --git a/tests/ui/issues/issue-16250.stderr b/tests/ui/issues/issue-16250.stderr new file mode 100644 index 000000000..5eb5e0864 --- /dev/null +++ b/tests/ui/issues/issue-16250.stderr @@ -0,0 +1,22 @@ +error: `extern` block uses type `Foo`, which is not FFI-safe + --> $DIR/issue-16250.rs:6:20 + | +LL | pub fn foo(x: (Foo)); + | ^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout +note: the type is defined here + --> $DIR/issue-16250.rs:3:1 + | +LL | pub struct Foo; + | ^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/issue-16250.rs:1:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(improper_ctypes)]` implied by `#[deny(warnings)]` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-16256.rs b/tests/ui/issues/issue-16256.rs new file mode 100644 index 000000000..eec23437b --- /dev/null +++ b/tests/ui/issues/issue-16256.rs @@ -0,0 +1,7 @@ +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let mut buf = Vec::new(); + |c: u8| buf.push(c); //~ WARN unused closure that must be used +} diff --git a/tests/ui/issues/issue-16256.stderr b/tests/ui/issues/issue-16256.stderr new file mode 100644 index 000000000..d920530b5 --- /dev/null +++ b/tests/ui/issues/issue-16256.stderr @@ -0,0 +1,11 @@ +warning: unused closure that must be used + --> $DIR/issue-16256.rs:6:5 + | +LL | |c: u8| buf.push(c); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: closures are lazy and do nothing unless called + = note: `#[warn(unused_must_use)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/issues/issue-16278.rs b/tests/ui/issues/issue-16278.rs new file mode 100644 index 000000000..2f47b694a --- /dev/null +++ b/tests/ui/issues/issue-16278.rs @@ -0,0 +1,10 @@ +// run-pass +// ignore-tidy-cr + +// this file has some special \r\n endings (use xxd to see them) + +fn main() {assert_eq!(b"", b"\
+ "); +assert_eq!(b"\n", b"
+"); +} diff --git a/tests/ui/issues/issue-16338.rs b/tests/ui/issues/issue-16338.rs new file mode 100644 index 000000000..321b3576c --- /dev/null +++ b/tests/ui/issues/issue-16338.rs @@ -0,0 +1,10 @@ +struct Slice<T> { + data: *const T, + len: usize, +} + +fn main() { + let Slice { data: data, len: len } = "foo"; + //~^ ERROR mismatched types + //~| found struct `Slice<_>` +} diff --git a/tests/ui/issues/issue-16338.stderr b/tests/ui/issues/issue-16338.stderr new file mode 100644 index 000000000..6878600b0 --- /dev/null +++ b/tests/ui/issues/issue-16338.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-16338.rs:7:9 + | +LL | let Slice { data: data, len: len } = "foo"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ----- this expression has type `&str` + | | + | expected `str`, found struct `Slice` + | + = note: expected type `str` + found struct `Slice<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-16401.rs b/tests/ui/issues/issue-16401.rs new file mode 100644 index 000000000..332352ca7 --- /dev/null +++ b/tests/ui/issues/issue-16401.rs @@ -0,0 +1,15 @@ +struct Slice<T> { + data: *const T, + len: usize, +} + +fn main() { + match () { + Slice { data: data, len: len } => (), + //~^ ERROR mismatched types + //~| expected unit type `()` + //~| found struct `Slice<_>` + //~| expected `()`, found struct `Slice` + _ => unreachable!() + } +} diff --git a/tests/ui/issues/issue-16401.stderr b/tests/ui/issues/issue-16401.stderr new file mode 100644 index 000000000..f8ea09070 --- /dev/null +++ b/tests/ui/issues/issue-16401.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-16401.rs:8:9 + | +LL | match () { + | -- this expression has type `()` +LL | Slice { data: data, len: len } => (), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Slice` + | + = note: expected unit type `()` + found struct `Slice<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-16441.rs b/tests/ui/issues/issue-16441.rs new file mode 100644 index 000000000..bafa204e0 --- /dev/null +++ b/tests/ui/issues/issue-16441.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +struct Empty; + +// This used to cause an ICE +#[allow(improper_ctypes_definitions)] +extern "C" fn ice(_a: Empty) {} + +fn main() { +} diff --git a/tests/ui/issues/issue-16452.rs b/tests/ui/issues/issue-16452.rs new file mode 100644 index 000000000..faf9edd3b --- /dev/null +++ b/tests/ui/issues/issue-16452.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +fn main() { + if true { return } + match () { + () => { static MAGIC: usize = 0; } + } +} diff --git a/tests/ui/issues/issue-16492.rs b/tests/ui/issues/issue-16492.rs new file mode 100644 index 000000000..7fa808237 --- /dev/null +++ b/tests/ui/issues/issue-16492.rs @@ -0,0 +1,67 @@ +// run-pass +#![allow(non_snake_case)] + +use std::rc::Rc; +use std::cell::Cell; + +struct Field { + number: usize, + state: Rc<Cell<usize>> +} + +impl Field { + fn new(number: usize, state: Rc<Cell<usize>>) -> Field { + Field { + number: number, + state: state + } + } +} + +impl Drop for Field { + fn drop(&mut self) { + println!("Dropping field {}", self.number); + assert_eq!(self.state.get(), self.number); + self.state.set(self.state.get()+1); + } +} + +struct NoDropImpl { + _one: Field, + _two: Field, + _three: Field +} + +struct HasDropImpl { + _one: Field, + _two: Field, + _three: Field +} + +impl Drop for HasDropImpl { + fn drop(&mut self) { + println!("HasDropImpl.drop()"); + assert_eq!(self._one.state.get(), 0); + self._one.state.set(1); + } +} + +pub fn main() { + let state = Rc::new(Cell::new(1)); + let noImpl = NoDropImpl { + _one: Field::new(1, state.clone()), + _two: Field::new(2, state.clone()), + _three: Field::new(3, state.clone()) + }; + drop(noImpl); + assert_eq!(state.get(), 4); + + state.set(0); + let hasImpl = HasDropImpl { + _one: Field::new(1, state.clone()), + _two: Field::new(2, state.clone()), + _three: Field::new(3, state.clone()) + }; + drop(hasImpl); + assert_eq!(state.get(), 4); +} diff --git a/tests/ui/issues/issue-16530.rs b/tests/ui/issues/issue-16530.rs new file mode 100644 index 000000000..25817a2a6 --- /dev/null +++ b/tests/ui/issues/issue-16530.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(deprecated)] + +use std::hash::{SipHasher, Hasher, Hash}; + +#[derive(Hash)] +struct Empty; + +pub fn main() { + let mut s1 = SipHasher::new(); + Empty.hash(&mut s1); + let mut s2 = SipHasher::new(); + Empty.hash(&mut s2); + assert_eq!(s1.finish(), s2.finish()); +} diff --git a/tests/ui/issues/issue-16538.mir.stderr b/tests/ui/issues/issue-16538.mir.stderr new file mode 100644 index 000000000..e320df4b7 --- /dev/null +++ b/tests/ui/issues/issue-16538.mir.stderr @@ -0,0 +1,29 @@ +error[E0015]: cannot call non-const fn `Y::foo` in statics + --> $DIR/issue-16538.rs:14:23 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:30 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:21 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0133. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/issues/issue-16538.rs b/tests/ui/issues/issue-16538.rs new file mode 100644 index 000000000..270fa3014 --- /dev/null +++ b/tests/ui/issues/issue-16538.rs @@ -0,0 +1,19 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +mod Y { + pub type X = usize; + extern "C" { + pub static x: *const usize; + } + pub fn foo(value: *const X) -> *const X { + value + } +} + +static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); +//~^ ERROR dereference of raw pointer +//~| ERROR E0015 +//~| ERROR use of extern static is unsafe and requires + +fn main() {} diff --git a/tests/ui/issues/issue-16538.thir.stderr b/tests/ui/issues/issue-16538.thir.stderr new file mode 100644 index 000000000..4a8628692 --- /dev/null +++ b/tests/ui/issues/issue-16538.thir.stderr @@ -0,0 +1,29 @@ +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:22 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer + | + = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior + +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-16538.rs:14:30 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error[E0015]: cannot call non-const fn `Y::foo` in statics + --> $DIR/issue-16538.rs:14:23 + | +LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0133. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/issues/issue-16560.rs b/tests/ui/issues/issue-16560.rs new file mode 100644 index 000000000..d5fffc7ef --- /dev/null +++ b/tests/ui/issues/issue-16560.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(unused_variables)] +// ignore-emscripten no threads support + +use std::thread; +use std::mem; + +fn main() { + let y = 0u8; + let closure = move |x: u8| y + x; + + // Check that both closures are capturing by value + assert_eq!(1, mem::size_of_val(&closure)); + + thread::spawn(move|| { + let ok = closure; + }).join().ok().unwrap(); +} diff --git a/tests/ui/issues/issue-16562.rs b/tests/ui/issues/issue-16562.rs new file mode 100644 index 000000000..e16a35158 --- /dev/null +++ b/tests/ui/issues/issue-16562.rs @@ -0,0 +1,17 @@ +trait MatrixShape {} + +struct Col<D, C> { + data: D, + col: C, +} + +trait Collection { fn len(&self) -> usize; } + +impl<T, M: MatrixShape> Collection for Col<M, usize> { +//~^ ERROR type parameter `T` is not constrained + fn len(&self) -> usize { + unimplemented!() + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-16562.stderr b/tests/ui/issues/issue-16562.stderr new file mode 100644 index 000000000..3fe7507e8 --- /dev/null +++ b/tests/ui/issues/issue-16562.stderr @@ -0,0 +1,9 @@ +error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-16562.rs:10:6 + | +LL | impl<T, M: MatrixShape> Collection for Col<M, usize> { + | ^ unconstrained type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/issues/issue-16596.rs b/tests/ui/issues/issue-16596.rs new file mode 100644 index 000000000..e7a096302 --- /dev/null +++ b/tests/ui/issues/issue-16596.rs @@ -0,0 +1,22 @@ +// check-pass +#![allow(dead_code)] + +trait MatrixRow { fn dummy(&self) { }} + +struct Mat; + +impl<'a> MatrixRow for &'a Mat {} + +struct Rows<M: MatrixRow> { + mat: M, +} + +impl<'a> Iterator for Rows<&'a Mat> { + type Item = (); + + fn next(&mut self) -> Option<()> { + unimplemented!() + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-1660.rs b/tests/ui/issues/issue-1660.rs new file mode 100644 index 000000000..aa60a8d8a --- /dev/null +++ b/tests/ui/issues/issue-1660.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 + +pub fn main() { + static _x: isize = 1<<2; +} diff --git a/tests/ui/issues/issue-16643.rs b/tests/ui/issues/issue-16643.rs new file mode 100644 index 000000000..c74a554af --- /dev/null +++ b/tests/ui/issues/issue-16643.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-16643.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_16643 as i; + +pub fn main() { + i::TreeBuilder { h: 3 }.process_token(); +} diff --git a/tests/ui/issues/issue-16648.rs b/tests/ui/issues/issue-16648.rs new file mode 100644 index 000000000..539f015fa --- /dev/null +++ b/tests/ui/issues/issue-16648.rs @@ -0,0 +1,11 @@ +// run-pass +fn main() { + let x: (isize, &[isize]) = (2, &[1, 2]); + assert_eq!(match x { + (0, &[_, _]) => 0, + (1, _) => 1, + (2, &[_, _]) => 2, + (2, _) => 3, + _ => 4 + }, 2); +} diff --git a/tests/ui/issues/issue-16668.rs b/tests/ui/issues/issue-16668.rs new file mode 100644 index 000000000..92efb42fe --- /dev/null +++ b/tests/ui/issues/issue-16668.rs @@ -0,0 +1,20 @@ +// check-pass +#![allow(dead_code)] +struct Parser<'a, I, O> { + parse: Box<dyn FnMut(I) -> Result<O, String> + 'a> +} + +impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { + fn compose<K: 'a>(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { + Parser { + parse: Box::new(move |x: I| { + match (self.parse)(x) { + Ok(r) => (rhs.parse)(r), + Err(e) => Err(e) + } + }) + } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-16671.rs b/tests/ui/issues/issue-16671.rs new file mode 100644 index 000000000..eff8e275b --- /dev/null +++ b/tests/ui/issues/issue-16671.rs @@ -0,0 +1,12 @@ +// run-pass + +#![deny(warnings)] + +fn foo<F: FnOnce()>(_f: F) { } + +fn main() { + let mut var = Vec::new(); + foo(move|| { + var.push(1); + }); +} diff --git a/tests/ui/issues/issue-16683.rs b/tests/ui/issues/issue-16683.rs new file mode 100644 index 000000000..72fa21bdd --- /dev/null +++ b/tests/ui/issues/issue-16683.rs @@ -0,0 +1,9 @@ +trait T<'a> { + fn a(&'a self) -> &'a bool; + fn b(&self) { + self.a(); + //~^ ERROR lifetime may not live long enough + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-16683.stderr b/tests/ui/issues/issue-16683.stderr new file mode 100644 index 000000000..fff681b2e --- /dev/null +++ b/tests/ui/issues/issue-16683.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/issue-16683.rs:4:9 + | +LL | trait T<'a> { + | -- lifetime `'a` defined here +LL | fn a(&'a self) -> &'a bool; +LL | fn b(&self) { + | - let's call the lifetime of this reference `'1` +LL | self.a(); + | ^^^^^^^^ argument requires that `'1` must outlive `'a` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-16725.rs b/tests/ui/issues/issue-16725.rs new file mode 100644 index 000000000..2cf8a6069 --- /dev/null +++ b/tests/ui/issues/issue-16725.rs @@ -0,0 +1,8 @@ +// aux-build:issue-16725.rs + +extern crate issue_16725 as foo; + +fn main() { + unsafe { foo::bar(); } + //~^ ERROR: function `bar` is private +} diff --git a/tests/ui/issues/issue-16725.stderr b/tests/ui/issues/issue-16725.stderr new file mode 100644 index 000000000..5f6eae73e --- /dev/null +++ b/tests/ui/issues/issue-16725.stderr @@ -0,0 +1,15 @@ +error[E0603]: function `bar` is private + --> $DIR/issue-16725.rs:6:19 + | +LL | unsafe { foo::bar(); } + | ^^^ private function + | +note: the function `bar` is defined here + --> $DIR/auxiliary/issue-16725.rs:2:5 + | +LL | fn bar(); + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/issues/issue-16739.rs b/tests/ui/issues/issue-16739.rs new file mode 100644 index 000000000..b21ea4bcd --- /dev/null +++ b/tests/ui/issues/issue-16739.rs @@ -0,0 +1,45 @@ +// run-pass +#![feature(unboxed_closures, fn_traits)] + +// Test that unboxing shim for calling rust-call ABI methods through a +// trait box works and does not cause an ICE. + +struct Foo { foo: u32 } + +impl FnMut<()> for Foo { + extern "rust-call" fn call_mut(&mut self, _: ()) -> u32 { self.foo } +} + +impl FnOnce<()> for Foo { + type Output = u32; + extern "rust-call" fn call_once(mut self, _: ()) -> u32 { self.call_mut(()) } +} + +impl FnMut<(u32,)> for Foo { + extern "rust-call" fn call_mut(&mut self, (x,): (u32,)) -> u32 { self.foo + x } +} + +impl FnOnce<(u32,)> for Foo { + type Output = u32; + extern "rust-call" fn call_once(mut self, args: (u32,)) -> u32 { self.call_mut(args) } +} + +impl FnMut<(u32,u32)> for Foo { + extern "rust-call" fn call_mut(&mut self, (x, y): (u32, u32)) -> u32 { self.foo + x + y } +} + +impl FnOnce<(u32,u32)> for Foo { + type Output = u32; + extern "rust-call" fn call_once(mut self, args: (u32,u32)) -> u32 { self.call_mut(args) } +} + +fn main() { + let mut f = Box::new(Foo { foo: 42 }) as Box<dyn FnMut() -> u32>; + assert_eq!(f.call_mut(()), 42); + + let mut f = Box::new(Foo { foo: 40 }) as Box<dyn FnMut(u32) -> u32>; + assert_eq!(f.call_mut((2,)), 42); + + let mut f = Box::new(Foo { foo: 40 }) as Box<dyn FnMut(u32, u32) -> u32>; + assert_eq!(f.call_mut((1, 1)), 42); +} diff --git a/tests/ui/issues/issue-16745.rs b/tests/ui/issues/issue-16745.rs new file mode 100644 index 000000000..e9137df0f --- /dev/null +++ b/tests/ui/issues/issue-16745.rs @@ -0,0 +1,11 @@ +// run-pass +fn main() { + const X: u8 = 0; + let out: u8 = match 0u8 { + X => 99, + b'\t' => 1, + 1u8 => 2, + _ => 3, + }; + assert_eq!(out, 99); +} diff --git a/tests/ui/issues/issue-16774.rs b/tests/ui/issues/issue-16774.rs new file mode 100644 index 000000000..2b308ef76 --- /dev/null +++ b/tests/ui/issues/issue-16774.rs @@ -0,0 +1,45 @@ +// run-pass +#![feature(box_patterns)] + +use std::ops::{Deref, DerefMut}; + +struct X(Box<isize>); + +static mut DESTRUCTOR_RAN: bool = false; + +impl Drop for X { + fn drop(&mut self) { + unsafe { + assert!(!DESTRUCTOR_RAN); + DESTRUCTOR_RAN = true; + } + } +} + +impl Deref for X { + type Target = isize; + + fn deref(&self) -> &isize { + let &X(box ref x) = self; + x + } +} + +impl DerefMut for X { + fn deref_mut(&mut self) -> &mut isize { + let &mut X(box ref mut x) = self; + x + } +} + +fn main() { + { + let mut test = X(Box::new(5)); + { + let mut change = || { *test = 10 }; + change(); + } + assert_eq!(*test, 10); + } + assert!(unsafe { DESTRUCTOR_RAN }); +} diff --git a/tests/ui/issues/issue-16783.rs b/tests/ui/issues/issue-16783.rs new file mode 100644 index 000000000..4af4031d2 --- /dev/null +++ b/tests/ui/issues/issue-16783.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +pub fn main() { + let x = [1, 2, 3]; + let y = x; +} diff --git a/tests/ui/issues/issue-16819.rs b/tests/ui/issues/issue-16819.rs new file mode 100644 index 000000000..cc0200904 --- /dev/null +++ b/tests/ui/issues/issue-16819.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(unused_variables)] +// `#[cfg]` on struct field permits empty unusable struct + +struct S { + #[cfg(untrue)] + a: int, +} + +fn main() { + let s = S {}; +} diff --git a/tests/ui/issues/issue-16922-rpass.rs b/tests/ui/issues/issue-16922-rpass.rs new file mode 100644 index 000000000..c3c6ff304 --- /dev/null +++ b/tests/ui/issues/issue-16922-rpass.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +use std::any::Any; + +fn foo(_: &u8) { +} + +fn main() { + let _ = &foo as &dyn Any; +} diff --git a/tests/ui/issues/issue-16922.rs b/tests/ui/issues/issue-16922.rs new file mode 100644 index 000000000..bbbbf72db --- /dev/null +++ b/tests/ui/issues/issue-16922.rs @@ -0,0 +1,10 @@ +use std::any::Any; + +fn foo<T: Any>(value: &T) -> Box<dyn Any> { + Box::new(value) as Box<dyn Any> + //~^ ERROR lifetime may not live long enough +} + +fn main() { + let _ = foo(&5); +} diff --git a/tests/ui/issues/issue-16922.stderr b/tests/ui/issues/issue-16922.stderr new file mode 100644 index 000000000..9d9f32a97 --- /dev/null +++ b/tests/ui/issues/issue-16922.stderr @@ -0,0 +1,15 @@ +error: lifetime may not live long enough + --> $DIR/issue-16922.rs:4:5 + | +LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> { + | - let's call the lifetime of this reference `'1` +LL | Box::new(value) as Box<dyn Any> + | ^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static` + | +help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound + | +LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> { + | ++++ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-16939.rs b/tests/ui/issues/issue-16939.rs new file mode 100644 index 000000000..ad7248343 --- /dev/null +++ b/tests/ui/issues/issue-16939.rs @@ -0,0 +1,8 @@ +// Make sure we don't ICE when making an overloaded call with the +// wrong arity. + +fn _foo<F: Fn()> (f: F) { + |t| f(t); //~ ERROR E0057 +} + +fn main() {} diff --git a/tests/ui/issues/issue-16939.stderr b/tests/ui/issues/issue-16939.stderr new file mode 100644 index 000000000..766456454 --- /dev/null +++ b/tests/ui/issues/issue-16939.stderr @@ -0,0 +1,19 @@ +error[E0057]: this function takes 0 arguments but 1 argument was supplied + --> $DIR/issue-16939.rs:5:9 + | +LL | |t| f(t); + | ^ - argument unexpected + | +note: callable defined here + --> $DIR/issue-16939.rs:4:12 + | +LL | fn _foo<F: Fn()> (f: F) { + | ^^^^ +help: remove the extra argument + | +LL | |t| f(); + | ~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0057`. diff --git a/tests/ui/issues/issue-1696.rs b/tests/ui/issues/issue-1696.rs new file mode 100644 index 000000000..b5d77df3a --- /dev/null +++ b/tests/ui/issues/issue-1696.rs @@ -0,0 +1,8 @@ +// run-pass +use std::collections::HashMap; + +pub fn main() { + let mut m = HashMap::new(); + m.insert(b"foo".to_vec(), b"bar".to_vec()); + println!("{:?}", m); +} diff --git a/tests/ui/issues/issue-16966.rs b/tests/ui/issues/issue-16966.rs new file mode 100644 index 000000000..9c6188350 --- /dev/null +++ b/tests/ui/issues/issue-16966.rs @@ -0,0 +1,4 @@ +fn main() { + panic!(std::default::Default::default()); + //~^ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-16966.stderr b/tests/ui/issues/issue-16966.stderr new file mode 100644 index 000000000..60f5190db --- /dev/null +++ b/tests/ui/issues/issue-16966.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-16966.rs:2:5 + | +LL | panic!(std::default::Default::default()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `M` declared on the function `begin_panic` + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-16994.rs b/tests/ui/issues/issue-16994.rs new file mode 100644 index 000000000..8d3074bce --- /dev/null +++ b/tests/ui/issues/issue-16994.rs @@ -0,0 +1,9 @@ +// check-pass + +fn cb<'a,T>(_x: Box<dyn Fn((&'a i32, &'a (Vec<&'static i32>, bool))) -> T>) -> T { + panic!() +} + +fn main() { + cb(Box::new(|(k, &(ref v, b))| (*k, v.clone(), b))); +} diff --git a/tests/ui/issues/issue-17001.rs b/tests/ui/issues/issue-17001.rs new file mode 100644 index 000000000..68cb2865f --- /dev/null +++ b/tests/ui/issues/issue-17001.rs @@ -0,0 +1,5 @@ +mod foo {} + +fn main() { + let p = foo { x: () }; //~ ERROR expected struct, variant or union type, found module `foo` +} diff --git a/tests/ui/issues/issue-17001.stderr b/tests/ui/issues/issue-17001.stderr new file mode 100644 index 000000000..d7e606997 --- /dev/null +++ b/tests/ui/issues/issue-17001.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found module `foo` + --> $DIR/issue-17001.rs:4:13 + | +LL | let p = foo { x: () }; + | ^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/tests/ui/issues/issue-17033.rs b/tests/ui/issues/issue-17033.rs new file mode 100644 index 000000000..72a8cd982 --- /dev/null +++ b/tests/ui/issues/issue-17033.rs @@ -0,0 +1,6 @@ +fn f<'r>(p: &'r mut fn(p: &mut ())) { + (*p)(()) //~ ERROR mismatched types + //~| expected `&mut ()`, found `()` +} + +fn main() {} diff --git a/tests/ui/issues/issue-17033.stderr b/tests/ui/issues/issue-17033.stderr new file mode 100644 index 000000000..f26bee5ff --- /dev/null +++ b/tests/ui/issues/issue-17033.stderr @@ -0,0 +1,13 @@ +error[E0308]: mismatched types + --> $DIR/issue-17033.rs:2:10 + | +LL | (*p)(()) + | ---- ^^ + | | | + | | expected `&mut ()`, found `()` + | | help: consider mutably borrowing here: `&mut ()` + | arguments to this function are incorrect + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-17068.rs b/tests/ui/issues/issue-17068.rs new file mode 100644 index 000000000..fe2c1a34b --- /dev/null +++ b/tests/ui/issues/issue-17068.rs @@ -0,0 +1,12 @@ +// run-pass +// Test that regionck creates the right region links in the pattern +// binding of a for loop + +fn foo<'a>(v: &'a [usize]) -> &'a usize { + for &ref x in v { return x; } + unreachable!() +} + +fn main() { + assert_eq!(foo(&[0]), &0); +} diff --git a/tests/ui/issues/issue-17121.rs b/tests/ui/issues/issue-17121.rs new file mode 100644 index 000000000..1e7b9f015 --- /dev/null +++ b/tests/ui/issues/issue-17121.rs @@ -0,0 +1,31 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +use std::fs::File; +use std::io::{self, BufReader, Read}; + +struct Lexer<R: Read> +{ + reader: BufReader<R>, +} + +impl<R: Read> Lexer<R> +{ + pub fn new_from_reader(r: R) -> Lexer<R> + { + Lexer{reader: BufReader::new(r)} + } + + pub fn new_from_file(p: &str) -> io::Result<Lexer<File>> + { + Ok(Lexer::new_from_reader(File::open(p)?)) + } + + pub fn new_from_str<'a>(s: &'a str) -> Lexer<&'a [u8]> + { + Lexer::new_from_reader(s.as_bytes()) + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-17216.rs b/tests/ui/issues/issue-17216.rs new file mode 100644 index 000000000..05baa1bff --- /dev/null +++ b/tests/ui/issues/issue-17216.rs @@ -0,0 +1,21 @@ +// run-pass +#![allow(unused_variables)] +struct Leak<'a> { + dropped: &'a mut bool +} + +impl<'a> Drop for Leak<'a> { + fn drop(&mut self) { + *self.dropped = true; + } +} + +fn main() { + let mut dropped = false; + { + let leak = Leak { dropped: &mut dropped }; + for ((), leaked) in Some(((), leak)).into_iter() {} + } + + assert!(dropped); +} diff --git a/tests/ui/issues/issue-17252.rs b/tests/ui/issues/issue-17252.rs new file mode 100644 index 000000000..7141e4874 --- /dev/null +++ b/tests/ui/issues/issue-17252.rs @@ -0,0 +1,10 @@ +const FOO: usize = FOO; //~ ERROR E0391 + +fn main() { + let _x: [u8; FOO]; // caused stack overflow prior to fix + let _y: usize = 1 + { + const BAR: usize = BAR; + let _z: [u8; BAR]; // caused stack overflow prior to fix + 1 + }; +} diff --git a/tests/ui/issues/issue-17252.stderr b/tests/ui/issues/issue-17252.stderr new file mode 100644 index 000000000..aca5242b2 --- /dev/null +++ b/tests/ui/issues/issue-17252.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when const-evaluating + checking `FOO` + --> $DIR/issue-17252.rs:1:20 + | +LL | const FOO: usize = FOO; + | ^^^ + | + = note: ...which immediately requires const-evaluating + checking `FOO` again +note: cycle used when const-evaluating + checking `main::{constant#0}` + --> $DIR/issue-17252.rs:4:18 + | +LL | let _x: [u8; FOO]; // caused stack overflow prior to fix + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-17302.rs b/tests/ui/issues/issue-17302.rs new file mode 100644 index 000000000..cf7a2f1b0 --- /dev/null +++ b/tests/ui/issues/issue-17302.rs @@ -0,0 +1,26 @@ +// run-pass + +static mut DROPPED: [bool; 2] = [false, false]; + +struct A(usize); +struct Foo { _a: A, _b: isize } + +impl Drop for A { + fn drop(&mut self) { + let A(i) = *self; + unsafe { DROPPED[i] = true; } + } +} + +fn main() { + { + Foo { + _a: A(0), + ..Foo { _a: A(1), _b: 2 } + }; + } + unsafe { + assert!(DROPPED[0]); + assert!(DROPPED[1]); + } +} diff --git a/tests/ui/issues/issue-17322.rs b/tests/ui/issues/issue-17322.rs new file mode 100644 index 000000000..b4fc40c3f --- /dev/null +++ b/tests/ui/issues/issue-17322.rs @@ -0,0 +1,13 @@ +// run-pass +// pretty-expanded FIXME #23616 + +use std::io::{self, Write}; + +fn f(wr: &mut dyn Write) { + wr.write_all(b"hello").ok().expect("failed"); +} + +fn main() { + let mut wr = Box::new(io::stdout()) as Box<dyn Write>; + f(&mut wr); +} diff --git a/tests/ui/issues/issue-17336.rs b/tests/ui/issues/issue-17336.rs new file mode 100644 index 000000000..89ce59b11 --- /dev/null +++ b/tests/ui/issues/issue-17336.rs @@ -0,0 +1,9 @@ +// build-pass +#![allow(unused_must_use)] +#[allow(dead_code)] +fn check(a: &str) { + let x = a as *const str; + x == x; +} + +fn main() {} diff --git a/tests/ui/issues/issue-17337.rs b/tests/ui/issues/issue-17337.rs new file mode 100644 index 000000000..193f89f83 --- /dev/null +++ b/tests/ui/issues/issue-17337.rs @@ -0,0 +1,17 @@ +#![feature(staged_api)] +#![deny(deprecated)] + +#![unstable(feature = "unstable_test_feature", issue = "none")] + +struct Foo; + +impl Foo { + #[unstable(feature = "unstable_test_feature", issue = "none")] + #[deprecated(since = "1.0.0", note = "text")] + fn foo(self) {} +} + +fn main() { + Foo + .foo(); //~ ERROR use of deprecated +} diff --git a/tests/ui/issues/issue-17337.stderr b/tests/ui/issues/issue-17337.stderr new file mode 100644 index 000000000..34c2eb05f --- /dev/null +++ b/tests/ui/issues/issue-17337.stderr @@ -0,0 +1,14 @@ +error: use of deprecated associated function `Foo::foo`: text + --> $DIR/issue-17337.rs:16:6 + | +LL | .foo(); + | ^^^ + | +note: the lint level is defined here + --> $DIR/issue-17337.rs:2:9 + | +LL | #![deny(deprecated)] + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-17351.rs b/tests/ui/issues/issue-17351.rs new file mode 100644 index 000000000..62f6bcf15 --- /dev/null +++ b/tests/ui/issues/issue-17351.rs @@ -0,0 +1,10 @@ +// run-pass +// pretty-expanded FIXME #23616 + +trait Str { fn foo(&self) {} } +impl Str for str {} +impl<'a, S: ?Sized> Str for &'a S where S: Str {} + +fn main() { + let _: &dyn Str = &"x"; +} diff --git a/tests/ui/issues/issue-17361.rs b/tests/ui/issues/issue-17361.rs new file mode 100644 index 000000000..e97fc3afd --- /dev/null +++ b/tests/ui/issues/issue-17361.rs @@ -0,0 +1,9 @@ +// run-pass +// Test that astconv doesn't forget about mutability of &mut str + +// pretty-expanded FIXME #23616 + +fn main() { + fn foo<T: ?Sized>(_: &mut T) {} + let _f: fn(&mut str) = foo; +} diff --git a/tests/ui/issues/issue-17373.rs b/tests/ui/issues/issue-17373.rs new file mode 100644 index 000000000..dc3be48a7 --- /dev/null +++ b/tests/ui/issues/issue-17373.rs @@ -0,0 +1,4 @@ +fn main() { + *return //~ ERROR type `!` cannot be dereferenced + ; +} diff --git a/tests/ui/issues/issue-17373.stderr b/tests/ui/issues/issue-17373.stderr new file mode 100644 index 000000000..5c429d111 --- /dev/null +++ b/tests/ui/issues/issue-17373.stderr @@ -0,0 +1,9 @@ +error[E0614]: type `!` cannot be dereferenced + --> $DIR/issue-17373.rs:2:5 + | +LL | *return + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0614`. diff --git a/tests/ui/issues/issue-17385.rs b/tests/ui/issues/issue-17385.rs new file mode 100644 index 000000000..7400aadb0 --- /dev/null +++ b/tests/ui/issues/issue-17385.rs @@ -0,0 +1,29 @@ +struct X(isize); + +enum Enum { + Variant1, + Variant2 +} + +impl Drop for X { + fn drop(&mut self) {} +} +impl Drop for Enum { + fn drop(&mut self) {} +} + +fn main() { + let foo = X(1); + drop(foo); + match foo { //~ ERROR use of moved value + X(1) => (), + _ => unreachable!() + } + + let e = Enum::Variant2; + drop(e); + match e { //~ ERROR use of moved value + Enum::Variant1 => unreachable!(), + Enum::Variant2 => () + } +} diff --git a/tests/ui/issues/issue-17385.stderr b/tests/ui/issues/issue-17385.stderr new file mode 100644 index 000000000..77aa201b3 --- /dev/null +++ b/tests/ui/issues/issue-17385.stderr @@ -0,0 +1,23 @@ +error[E0382]: use of moved value: `foo` + --> $DIR/issue-17385.rs:18:5 + | +LL | let foo = X(1); + | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait +LL | drop(foo); + | --- value moved here +LL | match foo { + | ^^^^^^^^^ value used here after move + +error[E0382]: use of moved value: `e` + --> $DIR/issue-17385.rs:25:11 + | +LL | let e = Enum::Variant2; + | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait +LL | drop(e); + | - value moved here +LL | match e { + | ^ value used here after move + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-17405.rs b/tests/ui/issues/issue-17405.rs new file mode 100644 index 000000000..14781a7d3 --- /dev/null +++ b/tests/ui/issues/issue-17405.rs @@ -0,0 +1,9 @@ +enum Foo { + Bar(isize) +} + +fn main() { + match Foo::Bar(1) { + Foo { i } => () //~ ERROR expected struct, variant or union type, found enum `Foo` + } +} diff --git a/tests/ui/issues/issue-17405.stderr b/tests/ui/issues/issue-17405.stderr new file mode 100644 index 000000000..37274e239 --- /dev/null +++ b/tests/ui/issues/issue-17405.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found enum `Foo` + --> $DIR/issue-17405.rs:7:9 + | +LL | Foo { i } => () + | ^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/tests/ui/issues/issue-17431-1.rs b/tests/ui/issues/issue-17431-1.rs new file mode 100644 index 000000000..3b692cc0e --- /dev/null +++ b/tests/ui/issues/issue-17431-1.rs @@ -0,0 +1,6 @@ +struct Foo { foo: Option<Option<Foo>> } +//~^ ERROR recursive type `Foo` has infinite size + +impl Foo { fn bar(&self) {} } + +fn main() {} diff --git a/tests/ui/issues/issue-17431-1.stderr b/tests/ui/issues/issue-17431-1.stderr new file mode 100644 index 000000000..e3af8976c --- /dev/null +++ b/tests/ui/issues/issue-17431-1.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Foo` has infinite size + --> $DIR/issue-17431-1.rs:1:1 + | +LL | struct Foo { foo: Option<Option<Foo>> } + | ^^^^^^^^^^ --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Foo { foo: Option<Option<Box<Foo>>> } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-17431-2.rs b/tests/ui/issues/issue-17431-2.rs new file mode 100644 index 000000000..f7b9c6a55 --- /dev/null +++ b/tests/ui/issues/issue-17431-2.rs @@ -0,0 +1,8 @@ +struct Baz { q: Option<Foo> } +//~^ ERROR recursive types `Baz` and `Foo` have infinite size + +struct Foo { q: Option<Baz> } + +impl Foo { fn bar(&self) {} } + +fn main() {} diff --git a/tests/ui/issues/issue-17431-2.stderr b/tests/ui/issues/issue-17431-2.stderr new file mode 100644 index 000000000..39a99ec1e --- /dev/null +++ b/tests/ui/issues/issue-17431-2.stderr @@ -0,0 +1,20 @@ +error[E0072]: recursive types `Baz` and `Foo` have infinite size + --> $DIR/issue-17431-2.rs:1:1 + | +LL | struct Baz { q: Option<Foo> } + | ^^^^^^^^^^ --- recursive without indirection +... +LL | struct Foo { q: Option<Baz> } + | ^^^^^^^^^^ --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL ~ struct Baz { q: Option<Box<Foo>> } +LL | +LL | +LL ~ struct Foo { q: Option<Box<Baz>> } + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-17431-3.rs b/tests/ui/issues/issue-17431-3.rs new file mode 100644 index 000000000..83a63a88b --- /dev/null +++ b/tests/ui/issues/issue-17431-3.rs @@ -0,0 +1,8 @@ +use std::sync::Mutex; + +struct Foo { foo: Mutex<Option<Foo>> } +//~^ ERROR recursive type `Foo` has infinite size + +impl Foo { fn bar(&self) {} } + +fn main() {} diff --git a/tests/ui/issues/issue-17431-3.stderr b/tests/ui/issues/issue-17431-3.stderr new file mode 100644 index 000000000..394134c78 --- /dev/null +++ b/tests/ui/issues/issue-17431-3.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Foo` has infinite size + --> $DIR/issue-17431-3.rs:3:1 + | +LL | struct Foo { foo: Mutex<Option<Foo>> } + | ^^^^^^^^^^ --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Foo { foo: Mutex<Option<Box<Foo>>> } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-17431-4.rs b/tests/ui/issues/issue-17431-4.rs new file mode 100644 index 000000000..48f0dba2a --- /dev/null +++ b/tests/ui/issues/issue-17431-4.rs @@ -0,0 +1,8 @@ +use std::marker; + +struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> } +//~^ ERROR recursive type `Foo` has infinite size + +impl<T> Foo<T> { fn bar(&self) {} } + +fn main() {} diff --git a/tests/ui/issues/issue-17431-4.stderr b/tests/ui/issues/issue-17431-4.stderr new file mode 100644 index 000000000..3d141e44b --- /dev/null +++ b/tests/ui/issues/issue-17431-4.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Foo` has infinite size + --> $DIR/issue-17431-4.rs:3:1 + | +LL | struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> } + | ^^^^^^^^^^^^^ ------ recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Foo<T> { foo: Option<Option<Box<Foo<T>>>>, marker: marker::PhantomData<T> } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-17431-5.rs b/tests/ui/issues/issue-17431-5.rs new file mode 100644 index 000000000..0fd6ee611 --- /dev/null +++ b/tests/ui/issues/issue-17431-5.rs @@ -0,0 +1,11 @@ +use std::marker; + +struct Foo { foo: Bar<Foo> } + +struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> } +//~^ ERROR recursive type `Bar` has infinite size + +impl Foo { fn foo(&self) {} } + +fn main() { +} diff --git a/tests/ui/issues/issue-17431-5.stderr b/tests/ui/issues/issue-17431-5.stderr new file mode 100644 index 000000000..44a90a6fe --- /dev/null +++ b/tests/ui/issues/issue-17431-5.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-17431-5.rs:5:1 + | +LL | struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> } + | ^^^^^^^^^^^^^ -------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Bar<T> { x: Box<Bar<Foo>> , marker: marker::PhantomData<T> } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-17431-6.rs b/tests/ui/issues/issue-17431-6.rs new file mode 100644 index 000000000..b7e49873d --- /dev/null +++ b/tests/ui/issues/issue-17431-6.rs @@ -0,0 +1,8 @@ +use std::sync::Mutex; + +enum Foo { X(Mutex<Option<Foo>>) } +//~^ ERROR recursive type `Foo` has infinite size + +impl Foo { fn bar(self) {} } + +fn main() {} diff --git a/tests/ui/issues/issue-17431-6.stderr b/tests/ui/issues/issue-17431-6.stderr new file mode 100644 index 000000000..e0a822550 --- /dev/null +++ b/tests/ui/issues/issue-17431-6.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Foo` has infinite size + --> $DIR/issue-17431-6.rs:3:1 + | +LL | enum Foo { X(Mutex<Option<Foo>>) } + | ^^^^^^^^ --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | enum Foo { X(Mutex<Option<Box<Foo>>>) } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-17431-7.rs b/tests/ui/issues/issue-17431-7.rs new file mode 100644 index 000000000..4fd786278 --- /dev/null +++ b/tests/ui/issues/issue-17431-7.rs @@ -0,0 +1,6 @@ +enum Foo { Voo(Option<Option<Foo>>) } +//~^ ERROR recursive type `Foo` has infinite size + +impl Foo { fn bar(&self) {} } + +fn main() { } diff --git a/tests/ui/issues/issue-17431-7.stderr b/tests/ui/issues/issue-17431-7.stderr new file mode 100644 index 000000000..ecf072b8e --- /dev/null +++ b/tests/ui/issues/issue-17431-7.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Foo` has infinite size + --> $DIR/issue-17431-7.rs:1:1 + | +LL | enum Foo { Voo(Option<Option<Foo>>) } + | ^^^^^^^^ --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | enum Foo { Voo(Option<Option<Box<Foo>>>) } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-17441.rs b/tests/ui/issues/issue-17441.rs new file mode 100644 index 000000000..e5f83c4eb --- /dev/null +++ b/tests/ui/issues/issue-17441.rs @@ -0,0 +1,13 @@ +fn main() { + let _foo = &[1_usize, 2] as [usize]; + //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` + + let _bar = Box::new(1_usize) as dyn std::fmt::Debug; + //~^ ERROR cast to unsized type: `Box<usize>` as `dyn Debug` + + let _baz = 1_usize as dyn std::fmt::Debug; + //~^ ERROR cast to unsized type: `usize` as `dyn Debug` + + let _quux = [1_usize, 2] as [usize]; + //~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]` +} diff --git a/tests/ui/issues/issue-17441.stderr b/tests/ui/issues/issue-17441.stderr new file mode 100644 index 000000000..4dbe50178 --- /dev/null +++ b/tests/ui/issues/issue-17441.stderr @@ -0,0 +1,47 @@ +error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` + --> $DIR/issue-17441.rs:2:16 + | +LL | let _foo = &[1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an implicit coercion to `&[usize]` instead + --> $DIR/issue-17441.rs:2:16 + | +LL | let _foo = &[1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0620]: cast to unsized type: `Box<usize>` as `dyn Debug` + --> $DIR/issue-17441.rs:5:16 + | +LL | let _bar = Box::new(1_usize) as dyn std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^------------------- + | | + | help: you can cast to a `Box` instead: `Box<dyn std::fmt::Debug>` + +error[E0620]: cast to unsized type: `usize` as `dyn Debug` + --> $DIR/issue-17441.rs:8:16 + | +LL | let _baz = 1_usize as dyn std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a box or reference as appropriate + --> $DIR/issue-17441.rs:8:16 + | +LL | let _baz = 1_usize as dyn std::fmt::Debug; + | ^^^^^^^ + +error[E0620]: cast to unsized type: `[usize; 2]` as `[usize]` + --> $DIR/issue-17441.rs:11:17 + | +LL | let _quux = [1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a box or reference as appropriate + --> $DIR/issue-17441.rs:11:17 + | +LL | let _quux = [1_usize, 2] as [usize]; + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0620`. diff --git a/tests/ui/issues/issue-17450.rs b/tests/ui/issues/issue-17450.rs new file mode 100644 index 000000000..1ac0af175 --- /dev/null +++ b/tests/ui/issues/issue-17450.rs @@ -0,0 +1,7 @@ +// build-pass +#![allow(dead_code, warnings)] + +static mut x: isize = 3; +static mut y: isize = unsafe { x }; + +fn main() {} diff --git a/tests/ui/issues/issue-17503.rs b/tests/ui/issues/issue-17503.rs new file mode 100644 index 000000000..9a92c06e1 --- /dev/null +++ b/tests/ui/issues/issue-17503.rs @@ -0,0 +1,10 @@ +// run-pass +fn main() { + let s: &[isize] = &[0, 1, 2, 3, 4]; + let ss: &&[isize] = &s; + let sss: &&&[isize] = &ss; + + println!("{:?}", &s[..3]); + println!("{:?}", &ss[3..]); + println!("{:?}", &sss[2..4]); +} diff --git a/tests/ui/issues/issue-17546.rs b/tests/ui/issues/issue-17546.rs new file mode 100644 index 000000000..6c62010f1 --- /dev/null +++ b/tests/ui/issues/issue-17546.rs @@ -0,0 +1,42 @@ +// ignore-sgx std::os::fortanix_sgx::usercalls::raw::Result changes compiler suggestions + +use foo::MyEnum::Result; +use foo::NoResult; // Through a re-export + +mod foo { + pub use self::MyEnum::NoResult; + + pub enum MyEnum { + Result, + NoResult + } + + fn new() -> NoResult<MyEnum, String> { + //~^ ERROR expected type, found variant `NoResult` + unimplemented!() + } +} + +mod bar { + use foo::MyEnum::Result; + use foo; + + fn new() -> Result<foo::MyEnum, String> { + //~^ ERROR expected type, found variant `Result` + unimplemented!() + } +} + +fn new() -> Result<foo::MyEnum, String> { + //~^ ERROR expected type, found variant `Result` + unimplemented!() +} + +fn newer() -> NoResult<foo::MyEnum, String> { + //~^ ERROR expected type, found variant `NoResult` + unimplemented!() +} + +fn main() { + let _ = new(); +} diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr new file mode 100644 index 000000000..81592320a --- /dev/null +++ b/tests/ui/issues/issue-17546.stderr @@ -0,0 +1,73 @@ +error[E0573]: expected type, found variant `NoResult` + --> $DIR/issue-17546.rs:14:17 + | +LL | fn new() -> NoResult<MyEnum, String> { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + --> $SRC_DIR/core/src/result.rs:LL:COL + | + = note: similarly named enum `Result` defined here + | +help: try using the variant's enum + | +LL | fn new() -> foo::MyEnum { + | ~~~~~~~~~~~ +help: an enum with a similar name exists + | +LL | fn new() -> Result<MyEnum, String> { + | ~~~~~~ + +error[E0573]: expected type, found variant `Result` + --> $DIR/issue-17546.rs:24:17 + | +LL | fn new() -> Result<foo::MyEnum, String> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type + | +help: consider importing one of these items instead + | +LL | use std::fmt::Result; + | +LL | use std::io::Result; + | +LL | use std::result::Result; + | +LL | use std::thread::Result; + | + +error[E0573]: expected type, found variant `Result` + --> $DIR/issue-17546.rs:30:13 + | +LL | fn new() -> Result<foo::MyEnum, String> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type + | +help: consider importing one of these items instead + | +LL | use std::fmt::Result; + | +LL | use std::io::Result; + | +LL | use std::result::Result; + | +LL | use std::thread::Result; + | + +error[E0573]: expected type, found variant `NoResult` + --> $DIR/issue-17546.rs:35:15 + | +LL | fn newer() -> NoResult<foo::MyEnum, String> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $SRC_DIR/core/src/result.rs:LL:COL + | + = note: similarly named enum `Result` defined here + | +help: try using the variant's enum + | +LL | fn newer() -> foo::MyEnum { + | ~~~~~~~~~~~ +help: an enum with a similar name exists + | +LL | fn newer() -> Result<foo::MyEnum, String> { + | ~~~~~~ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0573`. diff --git a/tests/ui/issues/issue-17551.rs b/tests/ui/issues/issue-17551.rs new file mode 100644 index 000000000..a65957ce0 --- /dev/null +++ b/tests/ui/issues/issue-17551.rs @@ -0,0 +1,8 @@ +use std::marker; + +struct B<T>(marker::PhantomData<T>); + +fn main() { + let foo = B(marker::PhantomData); //~ ERROR type annotations needed + let closure = || foo; +} diff --git a/tests/ui/issues/issue-17551.stderr b/tests/ui/issues/issue-17551.stderr new file mode 100644 index 000000000..5f45a2f84 --- /dev/null +++ b/tests/ui/issues/issue-17551.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `B<T>` + --> $DIR/issue-17551.rs:6:9 + | +LL | let foo = B(marker::PhantomData); + | ^^^ + | +help: consider giving `foo` an explicit type, where the type for type parameter `T` is specified + | +LL | let foo: B<T> = B(marker::PhantomData); + | ++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-17651.rs b/tests/ui/issues/issue-17651.rs new file mode 100644 index 000000000..7629a5a3b --- /dev/null +++ b/tests/ui/issues/issue-17651.rs @@ -0,0 +1,7 @@ +// Test that moves of unsized values within closures are caught +// and rejected. + +fn main() { + (|| Box::new(*(&[0][..])))(); + //~^ ERROR the size for values of type +} diff --git a/tests/ui/issues/issue-17651.stderr b/tests/ui/issues/issue-17651.stderr new file mode 100644 index 000000000..b37811e19 --- /dev/null +++ b/tests/ui/issues/issue-17651.stderr @@ -0,0 +1,15 @@ +error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time + --> $DIR/issue-17651.rs:5:18 + | +LL | (|| Box::new(*(&[0][..])))(); + | -------- ^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | + = help: the trait `Sized` is not implemented for `[{integer}]` +note: required by a bound in `Box::<T>::new` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-17662.rs b/tests/ui/issues/issue-17662.rs new file mode 100644 index 000000000..a2683808b --- /dev/null +++ b/tests/ui/issues/issue-17662.rs @@ -0,0 +1,17 @@ +// run-pass +// aux-build:issue-17662.rs + + +extern crate issue_17662 as i; + +use std::marker; + +struct Bar<'a> { m: marker::PhantomData<&'a ()> } + +impl<'a> i::Foo<'a, usize> for Bar<'a> { + fn foo(&self) -> usize { 5 } +} + +pub fn main() { + assert_eq!(i::foo(&Bar { m: marker::PhantomData }), 5); +} diff --git a/tests/ui/issues/issue-17732.rs b/tests/ui/issues/issue-17732.rs new file mode 100644 index 000000000..8f63d5bae --- /dev/null +++ b/tests/ui/issues/issue-17732.rs @@ -0,0 +1,13 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +// pretty-expanded FIXME #23616 + +trait Person { + type string; + fn dummy(&self) { } +} + +struct Someone<P: Person>(std::marker::PhantomData<P>); + +fn main() {} diff --git a/tests/ui/issues/issue-17734.rs b/tests/ui/issues/issue-17734.rs new file mode 100644 index 000000000..ba8d6c21c --- /dev/null +++ b/tests/ui/issues/issue-17734.rs @@ -0,0 +1,15 @@ +// run-pass +// Test that generating drop glue for Box<str> doesn't ICE + + +fn f(s: Box<str>) -> Box<str> { + s +} + +fn main() { + // There is currently no safe way to construct a `Box<str>`, so improvise + let box_arr: Box<[u8]> = Box::new(['h' as u8, 'e' as u8, 'l' as u8, 'l' as u8, 'o' as u8]); + let box_str: Box<str> = unsafe { std::mem::transmute(box_arr) }; + assert_eq!(&*box_str, "hello"); + f(box_str); +} diff --git a/tests/ui/issues/issue-17740.rs b/tests/ui/issues/issue-17740.rs new file mode 100644 index 000000000..3b868555f --- /dev/null +++ b/tests/ui/issues/issue-17740.rs @@ -0,0 +1,18 @@ +struct Foo<'a> { + data: &'a[u8], +} + +impl <'a> Foo<'a>{ + fn bar(self: &mut Foo) { + //~^ mismatched `self` parameter type + //~| expected struct `Foo<'a>` + //~| found struct `Foo<'_>` + //~| lifetime mismatch + //~| mismatched `self` parameter type + //~| expected struct `Foo<'a>` + //~| found struct `Foo<'_>` + //~| lifetime mismatch + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-17740.stderr b/tests/ui/issues/issue-17740.stderr new file mode 100644 index 000000000..d17738041 --- /dev/null +++ b/tests/ui/issues/issue-17740.stderr @@ -0,0 +1,41 @@ +error[E0308]: mismatched `self` parameter type + --> $DIR/issue-17740.rs:6:18 + | +LL | fn bar(self: &mut Foo) { + | ^^^^^^^^ lifetime mismatch + | + = note: expected struct `Foo<'a>` + found struct `Foo<'_>` +note: the anonymous lifetime defined here... + --> $DIR/issue-17740.rs:6:23 + | +LL | fn bar(self: &mut Foo) { + | ^^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/issue-17740.rs:5:7 + | +LL | impl <'a> Foo<'a>{ + | ^^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/issue-17740.rs:6:18 + | +LL | fn bar(self: &mut Foo) { + | ^^^^^^^^ lifetime mismatch + | + = note: expected struct `Foo<'a>` + found struct `Foo<'_>` +note: the lifetime `'a` as defined here... + --> $DIR/issue-17740.rs:5:7 + | +LL | impl <'a> Foo<'a>{ + | ^^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/issue-17740.rs:6:23 + | +LL | fn bar(self: &mut Foo) { + | ^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-17746.rs b/tests/ui/issues/issue-17746.rs new file mode 100644 index 000000000..bab64a4b5 --- /dev/null +++ b/tests/ui/issues/issue-17746.rs @@ -0,0 +1,25 @@ +// check-pass +#![allow(dead_code)] +// Regression test for #17746 + +fn main() {} + +struct A; + +impl A { + fn b(&mut self) { + self.a() + } +} + +trait Foo { + fn dummy(&self) {} +} +trait Bar { + fn a(&self); +} + +impl Foo for A {} +impl<T> Bar for T where T: Foo { + fn a(&self) {} +} diff --git a/tests/ui/issues/issue-17758.rs b/tests/ui/issues/issue-17758.rs new file mode 100644 index 000000000..e2ee84694 --- /dev/null +++ b/tests/ui/issues/issue-17758.rs @@ -0,0 +1,12 @@ +// Test that regionck suggestions in a provided method of a trait +// don't ICE + +trait Foo<'a> { + fn foo(&'a self); + fn bar(&self) { + self.foo(); + //~^ ERROR lifetime may not live long enough + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-17758.stderr b/tests/ui/issues/issue-17758.stderr new file mode 100644 index 000000000..613ef6b90 --- /dev/null +++ b/tests/ui/issues/issue-17758.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/issue-17758.rs:7:9 + | +LL | trait Foo<'a> { + | -- lifetime `'a` defined here +LL | fn foo(&'a self); +LL | fn bar(&self) { + | - let's call the lifetime of this reference `'1` +LL | self.foo(); + | ^^^^^^^^^^ argument requires that `'1` must outlive `'a` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-17771.rs b/tests/ui/issues/issue-17771.rs new file mode 100644 index 000000000..2f6464668 --- /dev/null +++ b/tests/ui/issues/issue-17771.rs @@ -0,0 +1,21 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait Aaa { fn dummy(&self) { } } + +impl<'a> Aaa for &'a mut (dyn Aaa + 'a) {} + +struct Bar<'a> { + writer: &'a mut (dyn Aaa + 'a), +} + +fn baz(_: &mut dyn Aaa) { +} + +fn foo<'a>(mut bar: Bar<'a>) { + baz(&mut bar.writer); +} + +fn main() { +} diff --git a/tests/ui/issues/issue-17800.rs b/tests/ui/issues/issue-17800.rs new file mode 100644 index 000000000..5254f45d7 --- /dev/null +++ b/tests/ui/issues/issue-17800.rs @@ -0,0 +1,12 @@ +enum MyOption<T> { + MySome(T), + MyNone, +} + +fn main() { + match MyOption::MySome(42) { + MyOption::MySome { x: 42 } => (), + //~^ ERROR tuple variant `MyOption::MySome` written as struct variant + _ => (), + } +} diff --git a/tests/ui/issues/issue-17800.stderr b/tests/ui/issues/issue-17800.stderr new file mode 100644 index 000000000..baab67583 --- /dev/null +++ b/tests/ui/issues/issue-17800.stderr @@ -0,0 +1,14 @@ +error[E0769]: tuple variant `MyOption::MySome` written as struct variant + --> $DIR/issue-17800.rs:8:9 + | +LL | MyOption::MySome { x: 42 } => (), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | MyOption::MySome(42) => (), + | ~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0769`. diff --git a/tests/ui/issues/issue-17816.rs b/tests/ui/issues/issue-17816.rs new file mode 100644 index 000000000..7ca47d503 --- /dev/null +++ b/tests/ui/issues/issue-17816.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(unused_variables)] +use std::marker::PhantomData; + +fn main() { + struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F, marker: PhantomData<&'a ()> } + let f = |x: Vec<&str>| -> &str { "foobar" }; + let sym = Symbol { function: f, marker: PhantomData }; + (sym.function)(vec![]); +} diff --git a/tests/ui/issues/issue-17877.rs b/tests/ui/issues/issue-17877.rs new file mode 100644 index 000000000..126e01de5 --- /dev/null +++ b/tests/ui/issues/issue-17877.rs @@ -0,0 +1,13 @@ +// run-pass + +fn main() { + assert_eq!(match [0u8; 1024] { + _ => 42_usize, + }, 42_usize); + + assert_eq!(match [0u8; 1024] { + [1, ..] => 0_usize, + [0, ..] => 1_usize, + _ => 2_usize + }, 1_usize); +} diff --git a/tests/ui/issues/issue-17897.rs b/tests/ui/issues/issue-17897.rs new file mode 100644 index 000000000..6873c7ccb --- /dev/null +++ b/tests/ui/issues/issue-17897.rs @@ -0,0 +1,8 @@ +// run-pass +fn action(mut cb: Box<dyn FnMut(usize) -> usize>) -> usize { + cb(1) +} + +pub fn main() { + println!("num: {}", action(Box::new(move |u| u))); +} diff --git a/tests/ui/issues/issue-17904-2.rs b/tests/ui/issues/issue-17904-2.rs new file mode 100644 index 000000000..9603da097 --- /dev/null +++ b/tests/ui/issues/issue-17904-2.rs @@ -0,0 +1,6 @@ +// Test that we can parse a unit struct with a where clause, even if +// it leads to an error later on since `T` is unused. + +struct Foo<T> where T: Copy; //~ ERROR parameter `T` is never used + +fn main() {} diff --git a/tests/ui/issues/issue-17904-2.stderr b/tests/ui/issues/issue-17904-2.stderr new file mode 100644 index 000000000..62b7b7953 --- /dev/null +++ b/tests/ui/issues/issue-17904-2.stderr @@ -0,0 +1,11 @@ +error[E0392]: parameter `T` is never used + --> $DIR/issue-17904-2.rs:4:12 + | +LL | struct Foo<T> where T: Copy; + | ^ unused parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/issues/issue-17904.rs b/tests/ui/issues/issue-17904.rs new file mode 100644 index 000000000..c3f504ac1 --- /dev/null +++ b/tests/ui/issues/issue-17904.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +// Test that we can parse where clauses on various forms of tuple +// structs. + +// pretty-expanded FIXME #23616 + +struct Bar<T>(T) where T: Copy; +struct Bleh<T, U>(T, U) where T: Copy, U: Sized; +struct Baz<T> where T: Copy { + field: T +} + +fn main() {} diff --git a/tests/ui/issues/issue-17905-2.rs b/tests/ui/issues/issue-17905-2.rs new file mode 100644 index 000000000..44279cc86 --- /dev/null +++ b/tests/ui/issues/issue-17905-2.rs @@ -0,0 +1,18 @@ +#[derive(Debug)] +struct Pair<T, V> (T, V); + +impl Pair< + &str, + isize +> { + fn say(self: &Pair<&str, isize>) { +//~^ ERROR mismatched `self` parameter type +//~| ERROR mismatched `self` parameter type + println!("{:?}", self); + } +} + +fn main() { + let result = &Pair("shane", 1); + result.say(); +} diff --git a/tests/ui/issues/issue-17905-2.stderr b/tests/ui/issues/issue-17905-2.stderr new file mode 100644 index 000000000..88b5fbec6 --- /dev/null +++ b/tests/ui/issues/issue-17905-2.stderr @@ -0,0 +1,41 @@ +error[E0308]: mismatched `self` parameter type + --> $DIR/issue-17905-2.rs:8:18 + | +LL | fn say(self: &Pair<&str, isize>) { + | ^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected struct `Pair<&str, _>` + found struct `Pair<&str, _>` +note: the anonymous lifetime defined here... + --> $DIR/issue-17905-2.rs:8:24 + | +LL | fn say(self: &Pair<&str, isize>) { + | ^^^^ +note: ...does not necessarily outlive the anonymous lifetime as defined here + --> $DIR/issue-17905-2.rs:5:5 + | +LL | &str, + | ^ + +error[E0308]: mismatched `self` parameter type + --> $DIR/issue-17905-2.rs:8:18 + | +LL | fn say(self: &Pair<&str, isize>) { + | ^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected struct `Pair<&str, _>` + found struct `Pair<&str, _>` +note: the anonymous lifetime as defined here... + --> $DIR/issue-17905-2.rs:5:5 + | +LL | &str, + | ^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/issue-17905-2.rs:8:24 + | +LL | fn say(self: &Pair<&str, isize>) { + | ^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-17905.rs b/tests/ui/issues/issue-17905.rs new file mode 100644 index 000000000..dae9648b9 --- /dev/null +++ b/tests/ui/issues/issue-17905.rs @@ -0,0 +1,19 @@ +// run-pass + +#[derive(Debug)] +#[allow(unused_tuple_struct_fields)] +struct Pair<T, V> (T, V); + +impl Pair< + &str, + isize +> { + fn say(&self) { + println!("{:?}", self); + } +} + +fn main() { + let result = &Pair("shane", 1); + result.say(); +} diff --git a/tests/ui/issues/issue-17933.rs b/tests/ui/issues/issue-17933.rs new file mode 100644 index 000000000..6da4e6e15 --- /dev/null +++ b/tests/ui/issues/issue-17933.rs @@ -0,0 +1,9 @@ +pub static X: usize = 1; + +fn main() { + match 1 { + self::X => { }, + //~^ ERROR expected unit struct, unit variant or constant, found static `self::X` + _ => { }, + } +} diff --git a/tests/ui/issues/issue-17933.stderr b/tests/ui/issues/issue-17933.stderr new file mode 100644 index 000000000..33534d3f8 --- /dev/null +++ b/tests/ui/issues/issue-17933.stderr @@ -0,0 +1,9 @@ +error[E0532]: expected unit struct, unit variant or constant, found static `self::X` + --> $DIR/issue-17933.rs:5:9 + | +LL | self::X => { }, + | ^^^^^^^ not a unit struct, unit variant or constant + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/issues/issue-17954.rs b/tests/ui/issues/issue-17954.rs new file mode 100644 index 000000000..eb6a3d70f --- /dev/null +++ b/tests/ui/issues/issue-17954.rs @@ -0,0 +1,15 @@ +#![feature(thread_local)] + +#[thread_local] +static FOO: u8 = 3; + +fn main() { + let a = &FOO; + //~^ ERROR thread-local variable borrowed past end of function + //~| NOTE thread-local variables cannot be borrowed beyond the end of the function + + std::thread::spawn(move || { + println!("{}", a); + }); +} +//~^ NOTE end of enclosing function is here diff --git a/tests/ui/issues/issue-17954.stderr b/tests/ui/issues/issue-17954.stderr new file mode 100644 index 000000000..e08375fee --- /dev/null +++ b/tests/ui/issues/issue-17954.stderr @@ -0,0 +1,12 @@ +error[E0712]: thread-local variable borrowed past end of function + --> $DIR/issue-17954.rs:7:13 + | +LL | let a = &FOO; + | ^^^^ thread-local variables cannot be borrowed beyond the end of the function +... +LL | } + | - end of enclosing function is here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0712`. diff --git a/tests/ui/issues/issue-17959.rs b/tests/ui/issues/issue-17959.rs new file mode 100644 index 000000000..8bf9e6236 --- /dev/null +++ b/tests/ui/issues/issue-17959.rs @@ -0,0 +1,21 @@ +extern crate core; + +use core::ops::Drop; + +trait Bar {} + +struct G<T: ?Sized> { + _ptr: *const T +} + +impl<T> Drop for G<T> { +//~^ ERROR `Drop` impl requires `T: Sized` + fn drop(&mut self) { + if !self._ptr.is_null() { + } + } +} + +fn main() { + let x:G<dyn Bar>; +} diff --git a/tests/ui/issues/issue-17959.stderr b/tests/ui/issues/issue-17959.stderr new file mode 100644 index 000000000..fb795febf --- /dev/null +++ b/tests/ui/issues/issue-17959.stderr @@ -0,0 +1,15 @@ +error[E0367]: `Drop` impl requires `T: Sized` but the struct it is implemented for does not + --> $DIR/issue-17959.rs:11:6 + | +LL | impl<T> Drop for G<T> { + | ^ + | +note: the implementor must specify the same requirement + --> $DIR/issue-17959.rs:7:1 + | +LL | struct G<T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0367`. diff --git a/tests/ui/issues/issue-17994.rs b/tests/ui/issues/issue-17994.rs new file mode 100644 index 000000000..39b0a7ebe --- /dev/null +++ b/tests/ui/issues/issue-17994.rs @@ -0,0 +1,3 @@ +trait Tr {} +type Huh<T> where T: Tr = isize; //~ ERROR type parameter `T` is unused +fn main() {} diff --git a/tests/ui/issues/issue-17994.stderr b/tests/ui/issues/issue-17994.stderr new file mode 100644 index 000000000..61e1e496f --- /dev/null +++ b/tests/ui/issues/issue-17994.stderr @@ -0,0 +1,9 @@ +error[E0091]: type parameter `T` is unused + --> $DIR/issue-17994.rs:2:10 + | +LL | type Huh<T> where T: Tr = isize; + | ^ unused type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0091`. diff --git a/tests/ui/issues/issue-17999.rs b/tests/ui/issues/issue-17999.rs new file mode 100644 index 000000000..941f1e775 --- /dev/null +++ b/tests/ui/issues/issue-17999.rs @@ -0,0 +1,10 @@ +#![deny(unused_variables)] + +fn main() { + for _ in 1..101 { + let x = (); //~ ERROR: unused variable: `x` + match () { + a => {} //~ ERROR: unused variable: `a` + } + } +} diff --git a/tests/ui/issues/issue-17999.stderr b/tests/ui/issues/issue-17999.stderr new file mode 100644 index 000000000..4a1ef7350 --- /dev/null +++ b/tests/ui/issues/issue-17999.stderr @@ -0,0 +1,20 @@ +error: unused variable: `x` + --> $DIR/issue-17999.rs:5:13 + | +LL | let x = (); + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | +note: the lint level is defined here + --> $DIR/issue-17999.rs:1:9 + | +LL | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ + +error: unused variable: `a` + --> $DIR/issue-17999.rs:7:13 + | +LL | a => {} + | ^ help: if this is intentional, prefix it with an underscore: `_a` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-18058.rs b/tests/ui/issues/issue-18058.rs new file mode 100644 index 000000000..cced66717 --- /dev/null +++ b/tests/ui/issues/issue-18058.rs @@ -0,0 +1,4 @@ +impl Undefined {} +//~^ ERROR cannot find type `Undefined` in this scope + +fn main() {} diff --git a/tests/ui/issues/issue-18058.stderr b/tests/ui/issues/issue-18058.stderr new file mode 100644 index 000000000..18159ffc2 --- /dev/null +++ b/tests/ui/issues/issue-18058.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Undefined` in this scope + --> $DIR/issue-18058.rs:1:6 + | +LL | impl Undefined {} + | ^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-18088.rs b/tests/ui/issues/issue-18088.rs new file mode 100644 index 000000000..c557b5a65 --- /dev/null +++ b/tests/ui/issues/issue-18088.rs @@ -0,0 +1,8 @@ +// check-pass + +pub trait Indexable<T>: std::ops::Index<usize, Output = T> { + fn index2(&self, i: usize) -> &T { + &self[i] + } +} +fn main() {} diff --git a/tests/ui/issues/issue-18107.rs b/tests/ui/issues/issue-18107.rs new file mode 100644 index 000000000..4bf5b6c0f --- /dev/null +++ b/tests/ui/issues/issue-18107.rs @@ -0,0 +1,13 @@ +pub trait AbstractRenderer {} + +fn _create_render(_: &()) -> + dyn AbstractRenderer +//~^ ERROR return type cannot have an unboxed trait object +{ + match 0 { + _ => unimplemented!() + } +} + +fn main() { +} diff --git a/tests/ui/issues/issue-18107.stderr b/tests/ui/issues/issue-18107.stderr new file mode 100644 index 000000000..1669b550a --- /dev/null +++ b/tests/ui/issues/issue-18107.stderr @@ -0,0 +1,18 @@ +error[E0746]: return type cannot have an unboxed trait object + --> $DIR/issue-18107.rs:4:5 + | +LL | dyn AbstractRenderer + | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: use `impl AbstractRenderer` as the return type if all return paths have the same type but you want to expose only the trait in the signature + | +LL | impl AbstractRenderer + | +help: use a boxed trait object if all return paths implement trait `AbstractRenderer` + | +LL | Box<dyn AbstractRenderer> + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0746`. diff --git a/tests/ui/issues/issue-18110.rs b/tests/ui/issues/issue-18110.rs new file mode 100644 index 000000000..41c29e77d --- /dev/null +++ b/tests/ui/issues/issue-18110.rs @@ -0,0 +1,7 @@ +// run-pass +#![allow(unreachable_code)] +// pretty-expanded FIXME #23616 + +fn main() { + ({return},); +} diff --git a/tests/ui/issues/issue-18119.rs b/tests/ui/issues/issue-18119.rs new file mode 100644 index 000000000..e48dc51a2 --- /dev/null +++ b/tests/ui/issues/issue-18119.rs @@ -0,0 +1,12 @@ +const X: u8 = 1; +static Y: u8 = 1; +fn foo() {} + +impl X {} +//~^ ERROR expected type, found constant `X` +impl Y {} +//~^ ERROR expected type, found static `Y` +impl foo {} +//~^ ERROR expected type, found function `foo` + +fn main() {} diff --git a/tests/ui/issues/issue-18119.stderr b/tests/ui/issues/issue-18119.stderr new file mode 100644 index 000000000..ddee5a9da --- /dev/null +++ b/tests/ui/issues/issue-18119.stderr @@ -0,0 +1,21 @@ +error[E0573]: expected type, found constant `X` + --> $DIR/issue-18119.rs:5:6 + | +LL | impl X {} + | ^ not a type + +error[E0573]: expected type, found static `Y` + --> $DIR/issue-18119.rs:7:6 + | +LL | impl Y {} + | ^ not a type + +error[E0573]: expected type, found function `foo` + --> $DIR/issue-18119.rs:9:6 + | +LL | impl foo {} + | ^^^ not a type + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0573`. diff --git a/tests/ui/issues/issue-18159.rs b/tests/ui/issues/issue-18159.rs new file mode 100644 index 000000000..bd347d632 --- /dev/null +++ b/tests/ui/issues/issue-18159.rs @@ -0,0 +1,3 @@ +fn main() { + let x; //~ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-18159.stderr b/tests/ui/issues/issue-18159.stderr new file mode 100644 index 000000000..5e0589eed --- /dev/null +++ b/tests/ui/issues/issue-18159.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-18159.rs:2:9 + | +LL | let x; + | ^ + | +help: consider giving `x` an explicit type + | +LL | let x: /* Type */; + | ++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-18173.rs b/tests/ui/issues/issue-18173.rs new file mode 100644 index 000000000..11468040e --- /dev/null +++ b/tests/ui/issues/issue-18173.rs @@ -0,0 +1,12 @@ +// run-pass +trait Foo { + type T; +} + +// should be able to use a trait with an associated type without specifying it as an argument +trait Bar<F: Foo> { + fn bar(foo: &F); +} + +pub fn main() { +} diff --git a/tests/ui/issues/issue-18183.rs b/tests/ui/issues/issue-18183.rs new file mode 100644 index 000000000..64476d1c1 --- /dev/null +++ b/tests/ui/issues/issue-18183.rs @@ -0,0 +1,3 @@ +pub struct Foo<Bar=Bar>(Bar); //~ ERROR E0128 +pub struct Baz(Foo); +fn main() {} diff --git a/tests/ui/issues/issue-18183.stderr b/tests/ui/issues/issue-18183.stderr new file mode 100644 index 000000000..a7dc64708 --- /dev/null +++ b/tests/ui/issues/issue-18183.stderr @@ -0,0 +1,9 @@ +error[E0128]: generic parameters with a default cannot use forward declared identifiers + --> $DIR/issue-18183.rs:1:20 + | +LL | pub struct Foo<Bar=Bar>(Bar); + | ^^^ defaulted generic parameters cannot be forward declared + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0128`. diff --git a/tests/ui/issues/issue-18188.rs b/tests/ui/issues/issue-18188.rs new file mode 100644 index 000000000..ce166724a --- /dev/null +++ b/tests/ui/issues/issue-18188.rs @@ -0,0 +1,22 @@ +// check-pass +// pretty-expanded FIXME #23616 + +pub trait Promisable: Send + Sync {} +impl<T: Send + Sync> Promisable for T {} + +pub fn propagate<'a, T, E, F, G>(mut action: F) + -> Box<dyn FnMut(Result<T, E>) -> Result<T, E> + 'a> + where + T: Promisable + Clone + 'a, + E: Promisable + Clone + 'a, + F: FnMut(&T) -> Result<T, E> + Send + 'a, + G: FnMut(Result<T, E>) -> Result<T, E> + 'a { + Box::new(move |result: Result<T, E>| { + match result { + Ok(ref t) => action(t), + Err(ref e) => Err(e.clone()), + } + }) +} + +fn main() {} diff --git a/tests/ui/issues/issue-1821.rs b/tests/ui/issues/issue-1821.rs new file mode 100644 index 000000000..76ee9c3ed --- /dev/null +++ b/tests/ui/issues/issue-1821.rs @@ -0,0 +1,13 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// Issue #1821 - Don't recurse trying to typecheck this + + +// pretty-expanded FIXME #23616 + +enum t { + foo(Vec<t>) +} +pub fn main() {} diff --git a/tests/ui/issues/issue-18232.rs b/tests/ui/issues/issue-18232.rs new file mode 100644 index 000000000..7e6f6ef0f --- /dev/null +++ b/tests/ui/issues/issue-18232.rs @@ -0,0 +1,22 @@ +// run-pass +// pretty-expanded FIXME #23616 + +struct Cursor<'a>(::std::marker::PhantomData<&'a ()>); + +trait CursorNavigator { + fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool; +} + +struct SimpleNavigator; + +impl CursorNavigator for SimpleNavigator { + fn init_cursor<'a, 'b: 'a>(&'a self, _cursor: &mut Cursor<'b>) -> bool { + false + } +} + +fn main() { + let mut c = Cursor(::std::marker::PhantomData); + let n = SimpleNavigator; + n.init_cursor(&mut c); +} diff --git a/tests/ui/issues/issue-18352.rs b/tests/ui/issues/issue-18352.rs new file mode 100644 index 000000000..5d93ed064 --- /dev/null +++ b/tests/ui/issues/issue-18352.rs @@ -0,0 +1,14 @@ +// run-pass + +const X: &'static str = "12345"; + +fn test(s: String) -> bool { + match &*s { + X => true, + _ => false + } +} + +fn main() { + assert!(test("12345".to_string())); +} diff --git a/tests/ui/issues/issue-18353.rs b/tests/ui/issues/issue-18353.rs new file mode 100644 index 000000000..3d15c9980 --- /dev/null +++ b/tests/ui/issues/issue-18353.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] +// Test that wrapping an unsized struct in an enum which gets optimised does +// not ICE. + +// pretty-expanded FIXME #23616 + +struct Str { + f: [u8] +} + +fn main() { + let str: Option<&Str> = None; + let _ = str.is_some(); +} diff --git a/tests/ui/issues/issue-18389.rs b/tests/ui/issues/issue-18389.rs new file mode 100644 index 000000000..654dfb63b --- /dev/null +++ b/tests/ui/issues/issue-18389.rs @@ -0,0 +1,18 @@ +use std::any::Any; +use std::any::TypeId; + +trait Private<P, R> { + fn call(&self, p: P, r: R); +} +pub trait Public: Private< +//~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface + <Self as Public>::P, + <Self as Public>::R +> { + type P; + type R; + + fn call_inner(&self); +} + +fn main() {} diff --git a/tests/ui/issues/issue-18389.stderr b/tests/ui/issues/issue-18389.stderr new file mode 100644 index 000000000..6ce78c45d --- /dev/null +++ b/tests/ui/issues/issue-18389.stderr @@ -0,0 +1,16 @@ +error[E0445]: private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface + --> $DIR/issue-18389.rs:7:1 + | +LL | trait Private<P, R> { + | ------------------- `Private<<Self as Public>::P, <Self as Public>::R>` declared as private +... +LL | / pub trait Public: Private< +LL | | +LL | | <Self as Public>::P, +LL | | <Self as Public>::R +LL | | > { + | |_^ can't leak private trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0445`. diff --git a/tests/ui/issues/issue-18423.rs b/tests/ui/issues/issue-18423.rs new file mode 100644 index 000000000..a81b32f05 --- /dev/null +++ b/tests/ui/issues/issue-18423.rs @@ -0,0 +1,8 @@ +// Test that `Box` cannot be used with a lifetime argument. + +struct Foo<'a> { + x: Box<'a, isize> + //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied +} + +fn main() { } diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/issues/issue-18423.stderr new file mode 100644 index 000000000..bbf793662 --- /dev/null +++ b/tests/ui/issues/issue-18423.stderr @@ -0,0 +1,11 @@ +error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied + --> $DIR/issue-18423.rs:4:8 + | +LL | x: Box<'a, isize> + | ^^^ -- help: remove this lifetime argument + | | + | expected 0 lifetime arguments + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-18446-2.rs b/tests/ui/issues/issue-18446-2.rs new file mode 100644 index 000000000..85422d4d2 --- /dev/null +++ b/tests/ui/issues/issue-18446-2.rs @@ -0,0 +1,13 @@ +// check-pass +#![allow(dead_code)] +// Test that methods in trait impls should override default methods. + +trait T { + fn foo(&self) -> i32 { 0 } +} + +impl<'a> dyn T + 'a { + fn foo(&self) -> i32 { 1 } +} + +fn main() {} diff --git a/tests/ui/issues/issue-18446.rs b/tests/ui/issues/issue-18446.rs new file mode 100644 index 000000000..a2e238da0 --- /dev/null +++ b/tests/ui/issues/issue-18446.rs @@ -0,0 +1,19 @@ +// Test that name clashes between the method in an impl for the type +// and the method in the trait when both are in the same scope. + +trait T { + fn foo(&self); +} + +impl<'a> dyn T + 'a { + fn foo(&self) {} +} + +impl T for i32 { + fn foo(&self) {} +} + +fn main() { + let x: &dyn T = &0i32; + x.foo(); //~ ERROR multiple applicable items in scope [E0034] +} diff --git a/tests/ui/issues/issue-18446.stderr b/tests/ui/issues/issue-18446.stderr new file mode 100644 index 000000000..939cf0292 --- /dev/null +++ b/tests/ui/issues/issue-18446.stderr @@ -0,0 +1,24 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/issue-18446.rs:18:7 + | +LL | x.foo(); + | ^^^ multiple `foo` found + | +note: candidate #1 is defined in an impl for the type `(dyn T + 'a)` + --> $DIR/issue-18446.rs:9:5 + | +LL | fn foo(&self) {} + | ^^^^^^^^^^^^^ +note: candidate #2 is defined in the trait `T` + --> $DIR/issue-18446.rs:5:5 + | +LL | fn foo(&self); + | ^^^^^^^^^^^^^^ +help: disambiguate the associated function for candidate #2 + | +LL | T::foo(&x); + | ~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/issues/issue-18464.rs b/tests/ui/issues/issue-18464.rs new file mode 100644 index 000000000..14d2d0a6c --- /dev/null +++ b/tests/ui/issues/issue-18464.rs @@ -0,0 +1,12 @@ +// run-pass +#![deny(dead_code)] + +const LOW_RANGE: char = '0'; +const HIGH_RANGE: char = '9'; + +fn main() { + match '5' { + LOW_RANGE..=HIGH_RANGE => (), + _ => () + }; +} diff --git a/tests/ui/issues/issue-18501.rs b/tests/ui/issues/issue-18501.rs new file mode 100644 index 000000000..0ca23074c --- /dev/null +++ b/tests/ui/issues/issue-18501.rs @@ -0,0 +1,13 @@ +// run-pass +// Test that we don't ICE when inlining a function from another +// crate that uses a trait method as a value due to incorrectly +// translating the def ID of the trait during AST decoding. + +// aux-build:issue-18501.rs +// pretty-expanded FIXME #23616 + +extern crate issue_18501 as issue; + +fn main() { + issue::pass_method(); +} diff --git a/tests/ui/issues/issue-18514.rs b/tests/ui/issues/issue-18514.rs new file mode 100644 index 000000000..48e7f0741 --- /dev/null +++ b/tests/ui/issues/issue-18514.rs @@ -0,0 +1,16 @@ +// run-pass +// Test that we don't ICE when codegenning a generic impl method from +// an extern crate that contains a match expression on a local +// variable place where one of the match case bodies contains an +// expression that autoderefs through an overloaded generic deref +// impl. + +// aux-build:issue-18514.rs + +extern crate issue_18514 as ice; +use ice::{Tr, St}; + +fn main() { + let st: St<()> = St(vec![]); + st.tr(); +} diff --git a/tests/ui/issues/issue-18532.rs b/tests/ui/issues/issue-18532.rs new file mode 100644 index 000000000..31fd87961 --- /dev/null +++ b/tests/ui/issues/issue-18532.rs @@ -0,0 +1,7 @@ +// Test that overloaded call parameter checking does not ICE +// when a type error or unconstrained type variable propagates +// into it. + +fn main() { + (return)((),()); //~ ERROR expected function, found `!` +} diff --git a/tests/ui/issues/issue-18532.stderr b/tests/ui/issues/issue-18532.stderr new file mode 100644 index 000000000..4c224eb2d --- /dev/null +++ b/tests/ui/issues/issue-18532.stderr @@ -0,0 +1,11 @@ +error[E0618]: expected function, found `!` + --> $DIR/issue-18532.rs:6:5 + | +LL | (return)((),()); + | ^^^^^^^^------- + | | + | call expression requires function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-18539.rs b/tests/ui/issues/issue-18539.rs new file mode 100644 index 000000000..745df26e3 --- /dev/null +++ b/tests/ui/issues/issue-18539.rs @@ -0,0 +1,16 @@ +// run-pass +// Test that coercing bare fn's that return a zero sized type to +// a closure doesn't cause an LLVM ERROR + +// pretty-expanded FIXME #23616 + +struct Foo; + +fn uint_to_foo(_: usize) -> Foo { + Foo +} + +#[allow(unused_must_use)] +fn main() { + (0..10).map(uint_to_foo); +} diff --git a/tests/ui/issues/issue-18566.rs b/tests/ui/issues/issue-18566.rs new file mode 100644 index 000000000..9da904acf --- /dev/null +++ b/tests/ui/issues/issue-18566.rs @@ -0,0 +1,25 @@ +use std::ops::Deref; + +struct MyPtr<'a>(&'a mut usize); +impl<'a> Deref for MyPtr<'a> { + type Target = usize; + + fn deref<'b>(&'b self) -> &'b usize { self.0 } +} + +trait Tr { + fn poke(&self, s: &mut usize); +} + +impl Tr for usize { + fn poke(&self, s: &mut usize) { + *s = 2; + } +} + +fn main() { + let s = &mut 1; + + MyPtr(s).poke(s); + //~^ ERROR cannot borrow `*s` as mutable more than once at a time +} diff --git a/tests/ui/issues/issue-18566.stderr b/tests/ui/issues/issue-18566.stderr new file mode 100644 index 000000000..8db78935f --- /dev/null +++ b/tests/ui/issues/issue-18566.stderr @@ -0,0 +1,12 @@ +error[E0499]: cannot borrow `*s` as mutable more than once at a time + --> $DIR/issue-18566.rs:23:19 + | +LL | MyPtr(s).poke(s); + | - ---- ^ second mutable borrow occurs here + | | | + | | first borrow later used by call + | first mutable borrow occurs here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/issues/issue-18576.rs b/tests/ui/issues/issue-18576.rs new file mode 100644 index 000000000..389cf108b --- /dev/null +++ b/tests/ui/issues/issue-18576.rs @@ -0,0 +1,16 @@ +// run-fail +// error-pattern:stop +// ignore-emscripten no processes + +// #18576 +// Make sure that calling an extern function pointer in an unreachable +// context doesn't cause an LLVM assertion + +#[allow(unreachable_code)] +fn main() { + panic!("stop"); + let pointer = other; + pointer(); +} + +extern "C" fn other() {} diff --git a/tests/ui/issues/issue-18611.rs b/tests/ui/issues/issue-18611.rs new file mode 100644 index 000000000..91a765f34 --- /dev/null +++ b/tests/ui/issues/issue-18611.rs @@ -0,0 +1,9 @@ +fn add_state(op: <isize as HasState>::State) { +//~^ ERROR `isize: HasState` is not satisfied +} + +trait HasState { + type State; +} + +fn main() {} diff --git a/tests/ui/issues/issue-18611.stderr b/tests/ui/issues/issue-18611.stderr new file mode 100644 index 000000000..bd18d4622 --- /dev/null +++ b/tests/ui/issues/issue-18611.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `isize: HasState` is not satisfied + --> $DIR/issue-18611.rs:1:18 + | +LL | fn add_state(op: <isize as HasState>::State) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-18685.rs b/tests/ui/issues/issue-18685.rs new file mode 100644 index 000000000..bfe24b663 --- /dev/null +++ b/tests/ui/issues/issue-18685.rs @@ -0,0 +1,21 @@ +// run-pass +// Test that the self param space is not used in a conflicting +// manner by unboxed closures within a default method on a trait + +// pretty-expanded FIXME #23616 + +trait Tr { + fn foo(&self); + + fn bar(&self) { + (|| { self.foo() })() + } +} + +impl Tr for () { + fn foo(&self) {} +} + +fn main() { + ().bar(); +} diff --git a/tests/ui/issues/issue-1871.rs b/tests/ui/issues/issue-1871.rs new file mode 100644 index 000000000..f7a2bdd56 --- /dev/null +++ b/tests/ui/issues/issue-1871.rs @@ -0,0 +1,12 @@ +// Tests that we don't generate a spurious error about f.honk's type +// being undeterminable +fn main() { + let f = 42; + + let _g = if f < 5 { + f.honk() //~ ERROR no method named `honk` found + } + else { + () + }; +} diff --git a/tests/ui/issues/issue-1871.stderr b/tests/ui/issues/issue-1871.stderr new file mode 100644 index 000000000..b774ca22d --- /dev/null +++ b/tests/ui/issues/issue-1871.stderr @@ -0,0 +1,9 @@ +error[E0599]: no method named `honk` found for type `{integer}` in the current scope + --> $DIR/issue-1871.rs:7:9 + | +LL | f.honk() + | ^^^^ method not found in `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-18711.rs b/tests/ui/issues/issue-18711.rs new file mode 100644 index 000000000..435841877 --- /dev/null +++ b/tests/ui/issues/issue-18711.rs @@ -0,0 +1,12 @@ +// run-pass +// Test that we don't panic on a RefCell borrow conflict in certain +// code paths involving unboxed closures. + +// pretty-expanded FIXME #23616 + +// aux-build:issue-18711.rs +extern crate issue_18711 as issue; + +fn main() { + (|| issue::inner(()))(); +} diff --git a/tests/ui/issues/issue-18738.rs b/tests/ui/issues/issue-18738.rs new file mode 100644 index 000000000..bcc1ec03f --- /dev/null +++ b/tests/ui/issues/issue-18738.rs @@ -0,0 +1,17 @@ +// check-pass +#![allow(dead_code)] +#[derive(Eq, PartialEq, PartialOrd, Ord)] +enum Test<'a> { + Int(&'a isize), + Slice(&'a [u8]), +} + +#[derive(Eq, PartialEq, PartialOrd, Ord)] +struct Version { + vendor_info: &'static str +} + +#[derive(Eq, PartialEq, PartialOrd, Ord)] +struct Foo(&'static str); + +fn main() {} diff --git a/tests/ui/issues/issue-18767.rs b/tests/ui/issues/issue-18767.rs new file mode 100644 index 000000000..2a5721b72 --- /dev/null +++ b/tests/ui/issues/issue-18767.rs @@ -0,0 +1,10 @@ +// run-pass +// Test that regionck uses the right memcat for patterns in for loops +// and doesn't ICE. + + +fn main() { + for &&x in Some(&0_usize).iter() { + assert_eq!(x, 0) + } +} diff --git a/tests/ui/issues/issue-18783.rs b/tests/ui/issues/issue-18783.rs new file mode 100644 index 000000000..d4851ac14 --- /dev/null +++ b/tests/ui/issues/issue-18783.rs @@ -0,0 +1,28 @@ +use std::cell::RefCell; + +fn main() { + let mut y = 1; + let c = RefCell::new(vec![]); + c.push(Box::new(|| y = 0)); + c.push(Box::new(|| y = 0)); +//~^ ERROR cannot borrow `y` as mutable more than once at a time +} + +fn ufcs() { + let mut y = 1; + let c = RefCell::new(vec![]); + + Push::push(&c, Box::new(|| y = 0)); + Push::push(&c, Box::new(|| y = 0)); +//~^ ERROR cannot borrow `y` as mutable more than once at a time +} + +trait Push<'c> { + fn push<'f: 'c>(&self, push: Box<dyn FnMut() + 'f>); +} + +impl<'c> Push<'c> for RefCell<Vec<Box<dyn FnMut() + 'c>>> { + fn push<'f: 'c>(&self, fun: Box<dyn FnMut() + 'f>) { + self.borrow_mut().push(fun) + } +} diff --git a/tests/ui/issues/issue-18783.stderr b/tests/ui/issues/issue-18783.stderr new file mode 100644 index 000000000..cc223ac46 --- /dev/null +++ b/tests/ui/issues/issue-18783.stderr @@ -0,0 +1,33 @@ +error[E0499]: cannot borrow `y` as mutable more than once at a time + --> $DIR/issue-18783.rs:7:21 + | +LL | c.push(Box::new(|| y = 0)); + | -- - first borrow occurs due to use of `y` in closure + | | + | first mutable borrow occurs here +LL | c.push(Box::new(|| y = 0)); + | ^^ - second borrow occurs due to use of `y` in closure + | | + | second mutable borrow occurs here +LL | +LL | } + | - first borrow might be used here, when `c` is dropped and runs the destructor for type `RefCell<Vec<Box<dyn FnMut()>>>` + +error[E0499]: cannot borrow `y` as mutable more than once at a time + --> $DIR/issue-18783.rs:16:29 + | +LL | Push::push(&c, Box::new(|| y = 0)); + | -- - first borrow occurs due to use of `y` in closure + | | + | first mutable borrow occurs here +LL | Push::push(&c, Box::new(|| y = 0)); + | ^^ - second borrow occurs due to use of `y` in closure + | | + | second mutable borrow occurs here +LL | +LL | } + | - first borrow might be used here, when `c` is dropped and runs the destructor for type `RefCell<Vec<Box<dyn FnMut()>>>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/issues/issue-18804/auxiliary/lib.rs b/tests/ui/issues/issue-18804/auxiliary/lib.rs new file mode 100644 index 000000000..e29d48285 --- /dev/null +++ b/tests/ui/issues/issue-18804/auxiliary/lib.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] +#![feature(linkage)] + +pub fn foo<T>() -> *const () { + extern "C" { + #[linkage = "extern_weak"] + static FOO: *const (); + } + unsafe { FOO } +} diff --git a/tests/ui/issues/issue-18804/main.rs b/tests/ui/issues/issue-18804/main.rs new file mode 100644 index 000000000..c36048ea5 --- /dev/null +++ b/tests/ui/issues/issue-18804/main.rs @@ -0,0 +1,19 @@ +// run-pass +// Test for issue #18804, #[linkage] does not propagate through generic +// functions. Failure results in a linker error. + +// ignore-asmjs no weak symbol support +// ignore-emscripten no weak symbol support +// ignore-windows no extern_weak linkage +// ignore-macos no extern_weak linkage + +// aux-build:lib.rs + +// rust-lang/rust#56772: nikic says we need this to be proper test. +// compile-flags: -C no-prepopulate-passes -C passes=name-anon-globals + +extern crate lib; + +fn main() { + lib::foo::<i32>(); +} diff --git a/tests/ui/issues/issue-18809.rs b/tests/ui/issues/issue-18809.rs new file mode 100644 index 000000000..cc5b4a64c --- /dev/null +++ b/tests/ui/issues/issue-18809.rs @@ -0,0 +1,12 @@ +// check-pass +trait Tup { + type T0; + type T1; +} + +impl Tup for isize { + type T0 = f32; + type T1 = (); +} + +fn main() {} diff --git a/tests/ui/issues/issue-18819.rs b/tests/ui/issues/issue-18819.rs new file mode 100644 index 000000000..e634c55f8 --- /dev/null +++ b/tests/ui/issues/issue-18819.rs @@ -0,0 +1,18 @@ +trait Foo { + type Item; +} + +struct X; + +impl Foo for X { + type Item = bool; +} + +fn print_x(_: &dyn Foo<Item=bool>, extra: &str) { + println!("{}", extra); +} + +fn main() { + print_x(X); + //~^ ERROR E0061 +} diff --git a/tests/ui/issues/issue-18819.stderr b/tests/ui/issues/issue-18819.stderr new file mode 100644 index 000000000..767fdd5ca --- /dev/null +++ b/tests/ui/issues/issue-18819.stderr @@ -0,0 +1,30 @@ +error[E0061]: this function takes 2 arguments but 1 argument was supplied + --> $DIR/issue-18819.rs:16:5 + | +LL | print_x(X); + | ^^^^^^^--- an argument of type `&str` is missing + | +note: expected reference, found struct `X` + --> $DIR/issue-18819.rs:16:13 + | +LL | print_x(X); + | ^ + = note: expected reference `&dyn Foo<Item = bool>` + found struct `X` +note: function defined here + --> $DIR/issue-18819.rs:11:4 + | +LL | fn print_x(_: &dyn Foo<Item=bool>, extra: &str) { + | ^^^^^^^ ---------------------- ----------- +help: consider borrowing here + | +LL | print_x(&X); + | ~~ +help: provide the argument + | +LL | print_x(/* &dyn Foo<Item = bool> */, /* &str */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/issues/issue-18845.rs b/tests/ui/issues/issue-18845.rs new file mode 100644 index 000000000..83fab4b5e --- /dev/null +++ b/tests/ui/issues/issue-18845.rs @@ -0,0 +1,16 @@ +// run-pass +// This used to generate invalid IR in that even if we took the +// `false` branch we'd still try to free the Box from the other +// arm. This was due to treating `*Box::new(9)` as an rvalue datum +// instead of as a place. + +fn test(foo: bool) -> u8 { + match foo { + true => *Box::new(9), + false => 0 + } +} + +fn main() { + assert_eq!(9, test(true)); +} diff --git a/tests/ui/issues/issue-18859.rs b/tests/ui/issues/issue-18859.rs new file mode 100644 index 000000000..c4575bce9 --- /dev/null +++ b/tests/ui/issues/issue-18859.rs @@ -0,0 +1,16 @@ +// run-pass + +mod foo { + pub mod bar { + pub mod baz { + pub fn name() -> &'static str { + module_path!() + } + } + } +} + +fn main() { + assert_eq!(module_path!(), "issue_18859"); + assert_eq!(foo::bar::baz::name(), "issue_18859::foo::bar::baz"); +} diff --git a/tests/ui/issues/issue-18906.rs b/tests/ui/issues/issue-18906.rs new file mode 100644 index 000000000..976a9f49b --- /dev/null +++ b/tests/ui/issues/issue-18906.rs @@ -0,0 +1,30 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub trait Borrow<Borrowed: ?Sized> { + fn borrow(&self) -> &Borrowed; +} + +impl<T: Sized> Borrow<T> for T { + fn borrow(&self) -> &T { self } +} + +trait Foo { + fn foo(&self, other: &Self); +} + +fn bar<K, Q>(k: &K, q: &Q) where K: Borrow<Q>, Q: Foo { + q.foo(k.borrow()) +} + +struct MyTree<K>(K); + +impl<K> MyTree<K> { + // This caused a failure in #18906 + fn bar<Q>(k: &K, q: &Q) where K: Borrow<Q>, Q: Foo { + q.foo(k.borrow()) + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-18913.rs b/tests/ui/issues/issue-18913.rs new file mode 100644 index 000000000..27fae6d77 --- /dev/null +++ b/tests/ui/issues/issue-18913.rs @@ -0,0 +1,9 @@ +// run-pass +// aux-build:issue-18913-1.rs +// aux-build:issue-18913-2.rs + +extern crate foo; + +fn main() { + assert_eq!(foo::foo(), 1); +} diff --git a/tests/ui/issues/issue-18919.rs b/tests/ui/issues/issue-18919.rs new file mode 100644 index 000000000..f06771e9e --- /dev/null +++ b/tests/ui/issues/issue-18919.rs @@ -0,0 +1,12 @@ +type FuncType<'f> = dyn Fn(&isize) -> isize + 'f; + +fn ho_func(f: Option<FuncType>) { + //~^ ERROR the size for values of type +} + +enum Option<T> { + Some(T), + None, +} + +fn main() {} diff --git a/tests/ui/issues/issue-18919.stderr b/tests/ui/issues/issue-18919.stderr new file mode 100644 index 000000000..b0b03a0ee --- /dev/null +++ b/tests/ui/issues/issue-18919.stderr @@ -0,0 +1,23 @@ +error[E0277]: the size for values of type `dyn for<'a> Fn(&'a isize) -> isize` cannot be known at compilation time + --> $DIR/issue-18919.rs:3:15 + | +LL | fn ho_func(f: Option<FuncType>) { + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `dyn for<'a> Fn(&'a isize) -> isize` +note: required by a bound in `Option` + --> $DIR/issue-18919.rs:7:13 + | +LL | enum Option<T> { + | ^ required by this bound in `Option` +help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` + --> $DIR/issue-18919.rs:7:13 + | +LL | enum Option<T> { + | ^ this could be changed to `T: ?Sized`... +LL | Some(T), + | - ...if indirection were used here: `Box<T>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-18952.rs b/tests/ui/issues/issue-18952.rs new file mode 100644 index 000000000..56378b59e --- /dev/null +++ b/tests/ui/issues/issue-18952.rs @@ -0,0 +1,56 @@ +// This issue tests fn_traits overloading on arity. +// run-pass + +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +struct Foo; + +impl Fn<(isize, isize)> for Foo { + extern "rust-call" fn call(&self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl FnMut<(isize, isize)> for Foo { + extern "rust-call" fn call_mut(&mut self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl FnOnce<(isize, isize)> for Foo { + type Output = (isize, isize); + extern "rust-call" fn call_once(self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl Fn<(isize, isize, isize)> for Foo { + extern "rust-call" fn call(&self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} + +impl FnMut<(isize, isize, isize)> for Foo { + extern "rust-call" fn call_mut(&mut self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} +impl FnOnce<(isize, isize, isize)> for Foo { + type Output = (isize, isize, isize); + extern "rust-call" fn call_once(self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} + +fn main() { + let foo = Foo; + assert_eq!(foo(1, 1), (2, 2)); + assert_eq!(foo(1, 1, 1), (4, 4, 4)); +} diff --git a/tests/ui/issues/issue-18959.rs b/tests/ui/issues/issue-18959.rs new file mode 100644 index 000000000..4b6f04e25 --- /dev/null +++ b/tests/ui/issues/issue-18959.rs @@ -0,0 +1,20 @@ +pub trait Foo { fn foo<T>(&self, ext_thing: &T); } +pub trait Bar: Foo { } +impl<T: Foo> Bar for T { } + +pub struct Thing; +impl Foo for Thing { + fn foo<T>(&self, _: &T) {} +} + +#[inline(never)] +fn foo(b: &dyn Bar) { + //~^ ERROR E0038 + b.foo(&0) +} + +fn main() { + let mut thing = Thing; + let test: &dyn Bar = &mut thing; + foo(test); +} diff --git a/tests/ui/issues/issue-18959.stderr b/tests/ui/issues/issue-18959.stderr new file mode 100644 index 000000000..b9e278736 --- /dev/null +++ b/tests/ui/issues/issue-18959.stderr @@ -0,0 +1,18 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/issue-18959.rs:11:12 + | +LL | fn foo(b: &dyn Bar) { + | ^^^^^^^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-18959.rs:1:20 + | +LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } + | ^^^ ...because method `foo` has generic type parameters +LL | pub trait Bar: Foo { } + | --- this trait cannot be made into an object... + = help: consider moving `foo` to another trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/issues/issue-18988.rs b/tests/ui/issues/issue-18988.rs new file mode 100644 index 000000000..708965d81 --- /dev/null +++ b/tests/ui/issues/issue-18988.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(dead_code)] +pub trait Foo : Send { } + +pub struct MyFoo { + children: Vec<Box<dyn Foo>>, +} + +impl Foo for MyFoo { } + +pub fn main() { } diff --git a/tests/ui/issues/issue-1900.rs b/tests/ui/issues/issue-1900.rs new file mode 100644 index 000000000..761bd3170 --- /dev/null +++ b/tests/ui/issues/issue-1900.rs @@ -0,0 +1,2 @@ +fn main<T>() { } +//~^ ERROR `main` function is not allowed to have generic parameters diff --git a/tests/ui/issues/issue-1900.stderr b/tests/ui/issues/issue-1900.stderr new file mode 100644 index 000000000..ce413662f --- /dev/null +++ b/tests/ui/issues/issue-1900.stderr @@ -0,0 +1,9 @@ +error[E0131]: `main` function is not allowed to have generic parameters + --> $DIR/issue-1900.rs:1:8 + | +LL | fn main<T>() { } + | ^^^ `main` cannot have generic parameters + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0131`. diff --git a/tests/ui/issues/issue-19001.rs b/tests/ui/issues/issue-19001.rs new file mode 100644 index 000000000..76c380c2f --- /dev/null +++ b/tests/ui/issues/issue-19001.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +// check that we handle recursive arrays correctly in `type_of` + +struct Loopy { + ptr: *mut [Loopy; 1] +} + +fn main() { + let _t = Loopy { ptr: core::ptr::null_mut() }; +} diff --git a/tests/ui/issues/issue-19037.rs b/tests/ui/issues/issue-19037.rs new file mode 100644 index 000000000..74623da14 --- /dev/null +++ b/tests/ui/issues/issue-19037.rs @@ -0,0 +1,20 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +struct Str([u8]); + +#[derive(Clone)] +struct CharSplits<'a, Sep> { + string: &'a Str, + sep: Sep, + allow_trailing_empty: bool, + only_ascii: bool, + finished: bool, +} + +fn clone(s: &Str) -> &Str { + Clone::clone(&s) +} + +fn main() {} diff --git a/tests/ui/issues/issue-19086.rs b/tests/ui/issues/issue-19086.rs new file mode 100644 index 000000000..42148c5f5 --- /dev/null +++ b/tests/ui/issues/issue-19086.rs @@ -0,0 +1,13 @@ +use Foo::FooB; + +enum Foo { + FooB { x: i32, y: i32 } +} + +fn main() { + let f = FooB { x: 3, y: 4 }; + match f { + FooB(a, b) => println!("{} {}", a, b), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + } +} diff --git a/tests/ui/issues/issue-19086.stderr b/tests/ui/issues/issue-19086.stderr new file mode 100644 index 000000000..a3c06a725 --- /dev/null +++ b/tests/ui/issues/issue-19086.stderr @@ -0,0 +1,12 @@ +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-19086.rs:10:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB(a, b) => println!("{} {}", a, b), + | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/issues/issue-19097.rs b/tests/ui/issues/issue-19097.rs new file mode 100644 index 000000000..2f4b0d575 --- /dev/null +++ b/tests/ui/issues/issue-19097.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +// regression test for #19097 + +struct Foo<T>(T); + +impl<'a, T> Foo<&'a T> { + fn foo(&self) {} +} +impl<'a, T> Foo<&'a mut T> { + fn foo(&self) {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-19098.rs b/tests/ui/issues/issue-19098.rs new file mode 100644 index 000000000..3d05f11b6 --- /dev/null +++ b/tests/ui/issues/issue-19098.rs @@ -0,0 +1,12 @@ +// check-pass +pub trait Handler { + fn handle(&self, _: &mut String); +} + +impl<F> Handler for F where F: for<'a, 'b> Fn(&'a mut String) { + fn handle(&self, st: &mut String) { + self(st) + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-19100.fixed b/tests/ui/issues/issue-19100.fixed new file mode 100644 index 000000000..029855de2 --- /dev/null +++ b/tests/ui/issues/issue-19100.fixed @@ -0,0 +1,29 @@ +// run-rustfix + +#![allow(non_snake_case)] +#![allow(dead_code)] +#![allow(unused_variables)] + +#[derive(Copy, Clone)] +enum Foo { + Bar, + Baz +} + +impl Foo { + fn foo(&self) { + match self { + & +Foo::Bar if true +//~^ ERROR pattern binding `Bar` is named the same as one of the variants of the type `Foo` +=> println!("bar"), + & +Foo::Baz if false +//~^ ERROR pattern binding `Baz` is named the same as one of the variants of the type `Foo` +=> println!("baz"), +_ => () + } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-19100.rs b/tests/ui/issues/issue-19100.rs new file mode 100644 index 000000000..bd9e4ea5b --- /dev/null +++ b/tests/ui/issues/issue-19100.rs @@ -0,0 +1,29 @@ +// run-rustfix + +#![allow(non_snake_case)] +#![allow(dead_code)] +#![allow(unused_variables)] + +#[derive(Copy, Clone)] +enum Foo { + Bar, + Baz +} + +impl Foo { + fn foo(&self) { + match self { + & +Bar if true +//~^ ERROR pattern binding `Bar` is named the same as one of the variants of the type `Foo` +=> println!("bar"), + & +Baz if false +//~^ ERROR pattern binding `Baz` is named the same as one of the variants of the type `Foo` +=> println!("baz"), +_ => () + } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-19100.stderr b/tests/ui/issues/issue-19100.stderr new file mode 100644 index 000000000..ebbf083b7 --- /dev/null +++ b/tests/ui/issues/issue-19100.stderr @@ -0,0 +1,17 @@ +error[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo` + --> $DIR/issue-19100.rs:17:1 + | +LL | Bar if true + | ^^^ help: to match on the variant, qualify the path: `Foo::Bar` + | + = note: `#[deny(bindings_with_variant_name)]` on by default + +error[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` + --> $DIR/issue-19100.rs:21:1 + | +LL | Baz if false + | ^^^ help: to match on the variant, qualify the path: `Foo::Baz` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0170`. diff --git a/tests/ui/issues/issue-19102.rs b/tests/ui/issues/issue-19102.rs new file mode 100644 index 000000000..1f32d10b6 --- /dev/null +++ b/tests/ui/issues/issue-19102.rs @@ -0,0 +1,12 @@ +// check-pass +#![allow(unused_imports)] +#![deny(unused_qualifications)] + +use self::A::B; + +#[derive(PartialEq)] +pub enum A { + B, +} + +fn main() {} diff --git a/tests/ui/issues/issue-19127.rs b/tests/ui/issues/issue-19127.rs new file mode 100644 index 000000000..c847ac9e4 --- /dev/null +++ b/tests/ui/issues/issue-19127.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +fn foo<T, F: FnOnce(T) -> T>(f: F) {} +fn id<'a>(input: &'a u8) -> &'a u8 { input } + +fn main() { + foo(id); +} diff --git a/tests/ui/issues/issue-19129-1.rs b/tests/ui/issues/issue-19129-1.rs new file mode 100644 index 000000000..03a969101 --- /dev/null +++ b/tests/ui/issues/issue-19129-1.rs @@ -0,0 +1,16 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait Trait<Input> { + type Output; + + fn method() -> <Self as Trait<Input>>::Output; +} + +impl<T> Trait<T> for () { + type Output = (); + + fn method() {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-19129-2.rs b/tests/ui/issues/issue-19129-2.rs new file mode 100644 index 000000000..991d79d41 --- /dev/null +++ b/tests/ui/issues/issue-19129-2.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +trait Trait<Input> { + type Output; + + fn method(&self, i: Input) -> bool { false } +} + +fn main() {} diff --git a/tests/ui/issues/issue-19135.rs b/tests/ui/issues/issue-19135.rs new file mode 100644 index 000000000..84540a3ff --- /dev/null +++ b/tests/ui/issues/issue-19135.rs @@ -0,0 +1,13 @@ +// run-pass +use std::marker::PhantomData; + +#[derive(Debug)] +struct LifetimeStruct<'a>(PhantomData<&'a ()>); + +fn main() { + takes_hrtb_closure(|lts| println!("{:?}", lts)); +} + +fn takes_hrtb_closure<F: for<'a>FnMut(LifetimeStruct<'a>)>(mut f: F) { + f(LifetimeStruct(PhantomData)); +} diff --git a/tests/ui/issues/issue-1920-1.rs b/tests/ui/issues/issue-1920-1.rs new file mode 100644 index 000000000..26553f56b --- /dev/null +++ b/tests/ui/issues/issue-1920-1.rs @@ -0,0 +1,14 @@ +//! Test that absolute path names are correct when a crate is not linked into the root namespace + +// aux-build:issue-1920.rs + +mod foo { + pub extern crate issue_1920; +} + +fn assert_clone<T>() where T : Clone { } + +fn main() { + assert_clone::<foo::issue_1920::S>(); + //~^ ERROR `S: Clone` is not satisfied +} diff --git a/tests/ui/issues/issue-1920-1.stderr b/tests/ui/issues/issue-1920-1.stderr new file mode 100644 index 000000000..a54692425 --- /dev/null +++ b/tests/ui/issues/issue-1920-1.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `S: Clone` is not satisfied + --> $DIR/issue-1920-1.rs:12:20 + | +LL | assert_clone::<foo::issue_1920::S>(); + | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-1.rs:9:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-1920-2.rs b/tests/ui/issues/issue-1920-2.rs new file mode 100644 index 000000000..8d4a5f663 --- /dev/null +++ b/tests/ui/issues/issue-1920-2.rs @@ -0,0 +1,12 @@ +//! Test that when a crate is linked under another name that name is used in global paths + +// aux-build:issue-1920.rs + +extern crate issue_1920 as bar; + +fn assert_clone<T>() where T : Clone { } + +fn main() { + assert_clone::<bar::S>(); + //~^ ERROR `S: Clone` is not satisfied +} diff --git a/tests/ui/issues/issue-1920-2.stderr b/tests/ui/issues/issue-1920-2.stderr new file mode 100644 index 000000000..1083b0112 --- /dev/null +++ b/tests/ui/issues/issue-1920-2.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `S: Clone` is not satisfied + --> $DIR/issue-1920-2.rs:10:20 + | +LL | assert_clone::<bar::S>(); + | ^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-2.rs:7:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-1920-3.rs b/tests/ui/issues/issue-1920-3.rs new file mode 100644 index 000000000..520db50f9 --- /dev/null +++ b/tests/ui/issues/issue-1920-3.rs @@ -0,0 +1,16 @@ +//! Test that when a crate is linked multiple times that the shortest absolute path name is used + +// aux-build:issue-1920.rs + +mod foo { + pub extern crate issue_1920; +} + +extern crate issue_1920; + +fn assert_clone<T>() where T : Clone { } + +fn main() { + assert_clone::<foo::issue_1920::S>(); + //~^ ERROR `S: Clone` is not satisfied +} diff --git a/tests/ui/issues/issue-1920-3.stderr b/tests/ui/issues/issue-1920-3.stderr new file mode 100644 index 000000000..3f0787c88 --- /dev/null +++ b/tests/ui/issues/issue-1920-3.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `S: Clone` is not satisfied + --> $DIR/issue-1920-3.rs:14:20 + | +LL | assert_clone::<foo::issue_1920::S>(); + | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `S` + | +note: required by a bound in `assert_clone` + --> $DIR/issue-1920-3.rs:11:32 + | +LL | fn assert_clone<T>() where T : Clone { } + | ^^^^^ required by this bound in `assert_clone` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-19244-1.rs b/tests/ui/issues/issue-19244-1.rs new file mode 100644 index 000000000..77fab7cfa --- /dev/null +++ b/tests/ui/issues/issue-19244-1.rs @@ -0,0 +1,6 @@ +const TUP: (usize,) = (42,); + +fn main() { + let a: [isize; TUP.1]; + //~^ ERROR no field `1` on type `(usize,)` +} diff --git a/tests/ui/issues/issue-19244-1.stderr b/tests/ui/issues/issue-19244-1.stderr new file mode 100644 index 000000000..1eb530542 --- /dev/null +++ b/tests/ui/issues/issue-19244-1.stderr @@ -0,0 +1,9 @@ +error[E0609]: no field `1` on type `(usize,)` + --> $DIR/issue-19244-1.rs:4:24 + | +LL | let a: [isize; TUP.1]; + | ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-19244-2.rs b/tests/ui/issues/issue-19244-2.rs new file mode 100644 index 000000000..c9a68b05c --- /dev/null +++ b/tests/ui/issues/issue-19244-2.rs @@ -0,0 +1,7 @@ +struct MyStruct { field: usize } +const STRUCT: MyStruct = MyStruct { field: 42 }; + +fn main() { + let a: [isize; STRUCT.nonexistent_field]; + //~^ no field `nonexistent_field` on type `MyStruct` +} diff --git a/tests/ui/issues/issue-19244-2.stderr b/tests/ui/issues/issue-19244-2.stderr new file mode 100644 index 000000000..54529fdf5 --- /dev/null +++ b/tests/ui/issues/issue-19244-2.stderr @@ -0,0 +1,11 @@ +error[E0609]: no field `nonexistent_field` on type `MyStruct` + --> $DIR/issue-19244-2.rs:5:27 + | +LL | let a: [isize; STRUCT.nonexistent_field]; + | ^^^^^^^^^^^^^^^^^ unknown field + | + = note: available fields are: `field` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-19293.rs b/tests/ui/issues/issue-19293.rs new file mode 100644 index 000000000..b6e9e3d06 --- /dev/null +++ b/tests/ui/issues/issue-19293.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-19293.rs +// pretty-expanded FIXME #23616 + +extern crate issue_19293; +use issue_19293::{Foo, MyEnum}; + +fn main() { + MyEnum::Foo(Foo(5)); +} diff --git a/tests/ui/issues/issue-19340-1.rs b/tests/ui/issues/issue-19340-1.rs new file mode 100644 index 000000000..e3cc2daae --- /dev/null +++ b/tests/ui/issues/issue-19340-1.rs @@ -0,0 +1,17 @@ +// run-pass +#![allow(unused_variables)] +// aux-build:issue-19340-1.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_19340_1 as lib; + +use lib::Homura; + +fn main() { + let homura = Homura::Madoka { name: "Kaname".to_string() }; + + match homura { + Homura::Madoka { name } => (), + }; +} diff --git a/tests/ui/issues/issue-19340-2.rs b/tests/ui/issues/issue-19340-2.rs new file mode 100644 index 000000000..a222e9e46 --- /dev/null +++ b/tests/ui/issues/issue-19340-2.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +enum Homura { + Madoka { + name: String, + age: u32, + }, +} + +fn main() { + let homura = Homura::Madoka { + name: "Akemi".to_string(), + age: 14, + }; + + match homura { + Homura::Madoka { + name, + age, + } => (), + }; +} diff --git a/tests/ui/issues/issue-19367.rs b/tests/ui/issues/issue-19367.rs new file mode 100644 index 000000000..0699533e7 --- /dev/null +++ b/tests/ui/issues/issue-19367.rs @@ -0,0 +1,32 @@ +// run-pass +struct S { + o: Option<String> +} + +// Make sure we don't reuse the same alloca when matching +// on field of struct or tuple which we reassign in the match body. + +fn main() { + let mut a = (0, Some("right".to_string())); + let b = match a.1 { + Some(v) => { + a.1 = Some("wrong".to_string()); + v + } + None => String::new() + }; + println!("{}", b); + assert_eq!(b, "right"); + + + let mut s = S{ o: Some("right".to_string()) }; + let b = match s.o { + Some(v) => { + s.o = Some("wrong".to_string()); + v + } + None => String::new(), + }; + println!("{}", b); + assert_eq!(b, "right"); +} diff --git a/tests/ui/issues/issue-19380.rs b/tests/ui/issues/issue-19380.rs new file mode 100644 index 000000000..5c10e2067 --- /dev/null +++ b/tests/ui/issues/issue-19380.rs @@ -0,0 +1,18 @@ +trait Qiz { + fn qiz(); +} + +struct Foo; +impl Qiz for Foo { + fn qiz() {} +} + +struct Bar { + foos: &'static [&'static (dyn Qiz + 'static)] +//~^ ERROR E0038 +} + +const FOO : Foo = Foo; +const BAR : Bar = Bar { foos: &[&FOO]}; + +fn main() { } diff --git a/tests/ui/issues/issue-19380.stderr b/tests/ui/issues/issue-19380.stderr new file mode 100644 index 000000000..b2aeb5edf --- /dev/null +++ b/tests/ui/issues/issue-19380.stderr @@ -0,0 +1,25 @@ +error[E0038]: the trait `Qiz` cannot be made into an object + --> $DIR/issue-19380.rs:11:29 + | +LL | foos: &'static [&'static (dyn Qiz + 'static)] + | ^^^^^^^^^^^^^^^^^ `Qiz` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-19380.rs:2:6 + | +LL | trait Qiz { + | --- this trait cannot be made into an object... +LL | fn qiz(); + | ^^^ ...because associated function `qiz` has no `self` parameter +help: consider turning `qiz` into a method by giving it a `&self` argument + | +LL | fn qiz(&self); + | +++++ +help: alternatively, consider constraining `qiz` so it does not apply to trait objects + | +LL | fn qiz() where Self: Sized; + | +++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/issues/issue-19398.rs b/tests/ui/issues/issue-19398.rs new file mode 100644 index 000000000..a9d0acaa2 --- /dev/null +++ b/tests/ui/issues/issue-19398.rs @@ -0,0 +1,12 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait T { + unsafe extern "Rust" fn foo(&self); +} + +impl T for () { + unsafe extern "Rust" fn foo(&self) {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-19404.rs b/tests/ui/issues/issue-19404.rs new file mode 100644 index 000000000..f1cf1feb0 --- /dev/null +++ b/tests/ui/issues/issue-19404.rs @@ -0,0 +1,37 @@ +// build-pass +#![allow(dead_code)] +#![allow(unused_variables)] +use std::any::TypeId; +use std::rc::Rc; + +type Fp<T> = Rc<T>; + +struct Engine; + +trait Component: 'static {} +impl Component for Engine {} + +trait Env { + fn get_component_type_id(&self, type_id: TypeId) -> Option<Fp<dyn Component>>; +} + +impl<'a> dyn Env + 'a { + fn get_component<T: Component>(&self) -> Option<Fp<T>> { + let x = self.get_component_type_id(TypeId::of::<T>()); + None + } +} + +trait Figment { + fn init(&mut self, env: &dyn Env); +} + +struct MyFigment; + +impl Figment for MyFigment { + fn init(&mut self, env: &dyn Env) { + let engine = env.get_component::<Engine>(); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-19479.rs b/tests/ui/issues/issue-19479.rs new file mode 100644 index 000000000..70bfe7213 --- /dev/null +++ b/tests/ui/issues/issue-19479.rs @@ -0,0 +1,19 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait Base { + fn dummy(&self) { } +} +trait AssocA { + type X: Base; + fn dummy(&self) { } +} +trait AssocB { + type Y: Base; + fn dummy(&self) { } +} +impl<T: AssocA> AssocB for T { + type Y = <T as AssocA>::X; +} + +fn main() {} diff --git a/tests/ui/issues/issue-19482.rs b/tests/ui/issues/issue-19482.rs new file mode 100644 index 000000000..3f3c5de9b --- /dev/null +++ b/tests/ui/issues/issue-19482.rs @@ -0,0 +1,13 @@ +// Test that a partially specified trait object with unspecified associated +// type does not type-check. + +trait Foo { + type A; + + fn dummy(&self) { } +} + +fn bar(x: &dyn Foo) {} +//~^ ERROR the associated type `A` (from trait `Foo`) must be specified + +pub fn main() {} diff --git a/tests/ui/issues/issue-19482.stderr b/tests/ui/issues/issue-19482.stderr new file mode 100644 index 000000000..d51cc1f08 --- /dev/null +++ b/tests/ui/issues/issue-19482.stderr @@ -0,0 +1,12 @@ +error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified + --> $DIR/issue-19482.rs:10:16 + | +LL | type A; + | ------ `A` defined here +... +LL | fn bar(x: &dyn Foo) {} + | ^^^ help: specify the associated type: `Foo<A = Type>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0191`. diff --git a/tests/ui/issues/issue-19499.rs b/tests/ui/issues/issue-19499.rs new file mode 100644 index 000000000..d09056ce3 --- /dev/null +++ b/tests/ui/issues/issue-19499.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(path_statements)] +#![allow(unused_variables)] +// Regression test for issue #19499. Due to incorrect caching of trait +// results for closures with upvars whose types were not fully +// computed, this rather bizarre little program (along with many more +// reasonable examples) let to ambiguity errors about not being able +// to infer sufficient type information. + +// pretty-expanded FIXME #23616 + +fn main() { + let n = 0; + let it = Some(1_usize).into_iter().inspect(|_| {n;}); +} diff --git a/tests/ui/issues/issue-19521.rs b/tests/ui/issues/issue-19521.rs new file mode 100644 index 000000000..a2a32a21a --- /dev/null +++ b/tests/ui/issues/issue-19521.rs @@ -0,0 +1,3 @@ +fn main() { + "".homura()(); //~ ERROR no method named `homura` found +} diff --git a/tests/ui/issues/issue-19521.stderr b/tests/ui/issues/issue-19521.stderr new file mode 100644 index 000000000..b6847cd75 --- /dev/null +++ b/tests/ui/issues/issue-19521.stderr @@ -0,0 +1,9 @@ +error[E0599]: no method named `homura` found for reference `&'static str` in the current scope + --> $DIR/issue-19521.rs:2:8 + | +LL | "".homura()(); + | ^^^^^^ method not found in `&'static str` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-19601.rs b/tests/ui/issues/issue-19601.rs new file mode 100644 index 000000000..176e6ba41 --- /dev/null +++ b/tests/ui/issues/issue-19601.rs @@ -0,0 +1,6 @@ +// check-pass + +trait A<T> {} +struct B<T> where B<T>: A<B<T>> { t: T } + +fn main() {} diff --git a/tests/ui/issues/issue-1962.fixed b/tests/ui/issues/issue-1962.fixed new file mode 100644 index 000000000..897fd172b --- /dev/null +++ b/tests/ui/issues/issue-1962.fixed @@ -0,0 +1,10 @@ +// compile-flags: -D while-true +// run-rustfix + +fn main() { + let mut i = 0; + 'a: loop { //~ ERROR denote infinite loops with `loop + i += 1; + if i == 5 { break 'a; } + } +} diff --git a/tests/ui/issues/issue-1962.rs b/tests/ui/issues/issue-1962.rs new file mode 100644 index 000000000..71e874100 --- /dev/null +++ b/tests/ui/issues/issue-1962.rs @@ -0,0 +1,10 @@ +// compile-flags: -D while-true +// run-rustfix + +fn main() { + let mut i = 0; + 'a: while true { //~ ERROR denote infinite loops with `loop + i += 1; + if i == 5 { break 'a; } + } +} diff --git a/tests/ui/issues/issue-1962.stderr b/tests/ui/issues/issue-1962.stderr new file mode 100644 index 000000000..4c32a4cf3 --- /dev/null +++ b/tests/ui/issues/issue-1962.stderr @@ -0,0 +1,10 @@ +error: denote infinite loops with `loop { ... }` + --> $DIR/issue-1962.rs:6:5 + | +LL | 'a: while true { + | ^^^^^^^^^^^^^^ help: use `loop` + | + = note: requested on the command line with `-D while-true` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-19631.rs b/tests/ui/issues/issue-19631.rs new file mode 100644 index 000000000..694e6dcd1 --- /dev/null +++ b/tests/ui/issues/issue-19631.rs @@ -0,0 +1,16 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait PoolManager { + type C; + fn dummy(&self) { } +} + +struct InnerPool<M> { + manager: M, +} + +impl<M> InnerPool<M> where M: PoolManager {} + +fn main() {} diff --git a/tests/ui/issues/issue-19632.rs b/tests/ui/issues/issue-19632.rs new file mode 100644 index 000000000..203976079 --- /dev/null +++ b/tests/ui/issues/issue-19632.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait PoolManager { + type C; + fn dummy(&self) { } +} + +struct InnerPool<M: PoolManager> { + manager: M, +} + +fn main() {} diff --git a/tests/ui/issues/issue-19692.rs b/tests/ui/issues/issue-19692.rs new file mode 100644 index 000000000..99eccc8a8 --- /dev/null +++ b/tests/ui/issues/issue-19692.rs @@ -0,0 +1,8 @@ +struct Homura; + +fn akemi(homura: Homura) { + let Some(ref madoka) = Some(homura.kaname()); //~ ERROR no method named `kaname` found + madoka.clone(); +} + +fn main() { } diff --git a/tests/ui/issues/issue-19692.stderr b/tests/ui/issues/issue-19692.stderr new file mode 100644 index 000000000..9e888ed75 --- /dev/null +++ b/tests/ui/issues/issue-19692.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `kaname` found for struct `Homura` in the current scope + --> $DIR/issue-19692.rs:4:40 + | +LL | struct Homura; + | ------------- method `kaname` not found for this struct +... +LL | let Some(ref madoka) = Some(homura.kaname()); + | ^^^^^^ method not found in `Homura` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-19707.rs b/tests/ui/issues/issue-19707.rs new file mode 100644 index 000000000..6bc7132af --- /dev/null +++ b/tests/ui/issues/issue-19707.rs @@ -0,0 +1,7 @@ +#![allow(dead_code)] + +type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier + +fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} //~ ERROR missing lifetime specifier + +fn main() {} diff --git a/tests/ui/issues/issue-19707.stderr b/tests/ui/issues/issue-19707.stderr new file mode 100644 index 000000000..3e1bb32c1 --- /dev/null +++ b/tests/ui/issues/issue-19707.stderr @@ -0,0 +1,36 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-19707.rs:3:28 + | +LL | type Foo = fn(&u8, &u8) -> &u8; + | --- --- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the type lifetime-generic with a new `'a` lifetime + | +LL | type Foo = for<'a> fn(&'a u8, &'a u8) -> &'a u8; + | +++++++ ++ ++ ++ +help: consider introducing a named lifetime parameter + | +LL | type Foo<'a> = fn(&'a u8, &'a u8) -> &'a u8; + | ++++ ++ ++ ++ + +error[E0106]: missing lifetime specifier + --> $DIR/issue-19707.rs:5:27 + | +LL | fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} + | --- --- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | fn bar<F: for<'a> Fn(&'a u8, &'a u8) -> &'a u8>(f: &F) {} + | +++++++ ++ ++ ++ +help: consider introducing a named lifetime parameter + | +LL | fn bar<'a, F: Fn(&'a u8, &'a u8) -> &'a u8>(f: &F) {} + | +++ ++ ++ ++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/issues/issue-19734.rs b/tests/ui/issues/issue-19734.rs new file mode 100644 index 000000000..fe4a327ae --- /dev/null +++ b/tests/ui/issues/issue-19734.rs @@ -0,0 +1,8 @@ +fn main() {} + +struct Type; + +impl Type { + undef!(); + //~^ ERROR cannot find macro `undef` in this scope +} diff --git a/tests/ui/issues/issue-19734.stderr b/tests/ui/issues/issue-19734.stderr new file mode 100644 index 000000000..81757974d --- /dev/null +++ b/tests/ui/issues/issue-19734.stderr @@ -0,0 +1,8 @@ +error: cannot find macro `undef` in this scope + --> $DIR/issue-19734.rs:6:5 + | +LL | undef!(); + | ^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-1974.rs b/tests/ui/issues/issue-1974.rs new file mode 100644 index 000000000..74a54a602 --- /dev/null +++ b/tests/ui/issues/issue-1974.rs @@ -0,0 +1,11 @@ +// run-pass +// Issue 1974 +// Don't double free the condition allocation +// pretty-expanded FIXME #23616 + +pub fn main() { + let s = "hej".to_string(); + while s != "".to_string() { + return; + } +} diff --git a/tests/ui/issues/issue-19811-escape-unicode.rs b/tests/ui/issues/issue-19811-escape-unicode.rs new file mode 100644 index 000000000..a2c50bc02 --- /dev/null +++ b/tests/ui/issues/issue-19811-escape-unicode.rs @@ -0,0 +1,9 @@ +// run-pass + +fn main() { + let mut escaped = String::from(""); + for c in '\u{10401}'.escape_unicode() { + escaped.push(c); + } + assert_eq!("\\u{10401}", escaped); +} diff --git a/tests/ui/issues/issue-19850.rs b/tests/ui/issues/issue-19850.rs new file mode 100644 index 000000000..4a578c398 --- /dev/null +++ b/tests/ui/issues/issue-19850.rs @@ -0,0 +1,22 @@ +// check-pass +#![allow(unused_variables)] +// Test that `<Type as Trait>::Output` and `Self::Output` are accepted as type annotations in let +// bindings + +// pretty-expanded FIXME #23616 + +trait Int { + fn one() -> Self; + fn leading_zeros(self) -> usize; +} + +trait Foo { + type T : Int; + + fn test(&self) { + let r: <Self as Foo>::T = Int::one(); + let r: Self::T = Int::one(); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-19922.rs b/tests/ui/issues/issue-19922.rs new file mode 100644 index 000000000..fede86f22 --- /dev/null +++ b/tests/ui/issues/issue-19922.rs @@ -0,0 +1,8 @@ +enum Homura { + Akemi { madoka: () } +} + +fn main() { + let homura = Homura::Akemi { kaname: () }; + //~^ ERROR variant `Homura::Akemi` has no field named `kaname` +} diff --git a/tests/ui/issues/issue-19922.stderr b/tests/ui/issues/issue-19922.stderr new file mode 100644 index 000000000..826b2ac04 --- /dev/null +++ b/tests/ui/issues/issue-19922.stderr @@ -0,0 +1,11 @@ +error[E0559]: variant `Homura::Akemi` has no field named `kaname` + --> $DIR/issue-19922.rs:6:34 + | +LL | let homura = Homura::Akemi { kaname: () }; + | ^^^^^^ `Homura::Akemi` does not have this field + | + = note: available fields are: `madoka` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0559`. diff --git a/tests/ui/issues/issue-19982.rs b/tests/ui/issues/issue-19982.rs new file mode 100644 index 000000000..12419c109 --- /dev/null +++ b/tests/ui/issues/issue-19982.rs @@ -0,0 +1,22 @@ +// check-pass + +#![feature(fn_traits, unboxed_closures)] + +#[allow(dead_code)] +struct Foo; + +impl Fn<(&(),)> for Foo { + extern "rust-call" fn call(&self, (_,): (&(),)) {} +} + +impl FnMut<(&(),)> for Foo { + extern "rust-call" fn call_mut(&mut self, (_,): (&(),)) {} +} + +impl FnOnce<(&(),)> for Foo { + type Output = (); + + extern "rust-call" fn call_once(self, (_,): (&(),)) {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-19991.rs b/tests/ui/issues/issue-19991.rs new file mode 100644 index 000000000..dd0efa972 --- /dev/null +++ b/tests/ui/issues/issue-19991.rs @@ -0,0 +1,9 @@ +// Test if the sugared `if let` construct correctly prints "missing an else clause" when an else +// clause does not exist, instead of the unsympathetic "`match` arms have incompatible types" + +fn main() { + if let Some(homura) = Some("madoka") { //~ ERROR missing an `else` clause + //~| expected integer, found `()` + 765 + }; +} diff --git a/tests/ui/issues/issue-19991.stderr b/tests/ui/issues/issue-19991.stderr new file mode 100644 index 000000000..57b0882b6 --- /dev/null +++ b/tests/ui/issues/issue-19991.stderr @@ -0,0 +1,16 @@ +error[E0317]: `if` may be missing an `else` clause + --> $DIR/issue-19991.rs:5:5 + | +LL | / if let Some(homura) = Some("madoka") { +LL | | +LL | | 765 + | | --- found here +LL | | }; + | |_____^ expected integer, found `()` + | + = note: `if` expressions without `else` evaluate to `()` + = help: consider adding an `else` block that evaluates to the expected type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0317`. diff --git a/tests/ui/issues/issue-20009.rs b/tests/ui/issues/issue-20009.rs new file mode 100644 index 000000000..f289e58c5 --- /dev/null +++ b/tests/ui/issues/issue-20009.rs @@ -0,0 +1,13 @@ +// check-pass +// Check that associated types are `Sized` + +// pretty-expanded FIXME #23616 + +trait Trait { + type Output; + + fn is_sized(&self) -> Self::Output; + fn wasnt_sized(&self) -> Self::Output { loop {} } +} + +fn main() {} diff --git a/tests/ui/issues/issue-20055-box-trait.rs b/tests/ui/issues/issue-20055-box-trait.rs new file mode 100644 index 000000000..772cd9d7e --- /dev/null +++ b/tests/ui/issues/issue-20055-box-trait.rs @@ -0,0 +1,41 @@ +// run-pass +// See Issues #20055 and #21695. + +// We are checking here that the temporaries `Box<[i8, k]>`, for `k` +// in 1, 2, 3, 4, that are induced by the match expression are +// properly handled, in that only *one* will be initialized by +// whichever arm is run, and subsequently dropped at the end of the +// statement surrounding the `match`. + +trait Boo { + fn dummy(&self) { } +} + +impl Boo for [i8; 1] { } +impl Boo for [i8; 2] { } +impl Boo for [i8; 3] { } +impl Boo for [i8; 4] { } + +pub fn foo(box_1: fn () -> Box<[i8; 1]>, + box_2: fn () -> Box<[i8; 2]>, + box_3: fn () -> Box<[i8; 3]>, + box_4: fn () -> Box<[i8; 4]>, + ) { + println!("Hello World 1"); + let _: Box<dyn Boo> = match 3 { + 1 => box_1(), + 2 => box_2(), + 3 => box_3(), + _ => box_4(), + }; + println!("Hello World 2"); +} + +pub fn main() { + fn box_1() -> Box<[i8; 1]> { Box::new( [1; 1] ) } + fn box_2() -> Box<[i8; 2]> { Box::new( [1; 2] ) } + fn box_3() -> Box<[i8; 3]> { Box::new( [1; 3] ) } + fn box_4() -> Box<[i8; 4]> { Box::new( [1; 4] ) } + + foo(box_1, box_2, box_3, box_4); +} diff --git a/tests/ui/issues/issue-20055-box-unsized-array.rs b/tests/ui/issues/issue-20055-box-unsized-array.rs new file mode 100644 index 000000000..1246c8065 --- /dev/null +++ b/tests/ui/issues/issue-20055-box-unsized-array.rs @@ -0,0 +1,29 @@ +// run-pass +// Issue #2005: Check that boxed fixed-size arrays are properly +// accounted for (namely, only deallocated if they were actually +// created) when they appear as temporaries in unused arms of a match +// expression. + +pub fn foo(box_1: fn () -> Box<[i8; 1]>, + box_2: fn () -> Box<[i8; 20]>, + box_3: fn () -> Box<[i8; 300]>, + box_4: fn () -> Box<[i8; 4000]>, + ) { + println!("Hello World 1"); + let _: Box<[i8]> = match 3 { + 1 => box_1(), + 2 => box_2(), + 3 => box_3(), + _ => box_4(), + }; + println!("Hello World 2"); +} + +pub fn main() { + fn box_1() -> Box<[i8; 1]> { Box::new( [1] ) } + fn box_2() -> Box<[i8; 20]> { Box::new( [1; 20] ) } + fn box_3() -> Box<[i8; 300]> { Box::new( [1; 300] ) } + fn box_4() -> Box<[i8; 4000]> { Box::new( [1; 4000] ) } + + foo(box_1, box_2, box_3, box_4); +} diff --git a/tests/ui/issues/issue-20162.rs b/tests/ui/issues/issue-20162.rs new file mode 100644 index 000000000..b491bc37f --- /dev/null +++ b/tests/ui/issues/issue-20162.rs @@ -0,0 +1,7 @@ +struct X { x: i32 } + +fn main() { + let mut b: Vec<X> = vec![]; + b.sort(); + //~^ ERROR `X: Ord` is not satisfied +} diff --git a/tests/ui/issues/issue-20162.stderr b/tests/ui/issues/issue-20162.stderr new file mode 100644 index 000000000..1c5b76fbf --- /dev/null +++ b/tests/ui/issues/issue-20162.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `X: Ord` is not satisfied + --> $DIR/issue-20162.rs:5:7 + | +LL | b.sort(); + | ^^^^ the trait `Ord` is not implemented for `X` + | +note: required by a bound in `slice::<impl [T]>::sort` + --> $SRC_DIR/alloc/src/slice.rs:LL:COL +help: consider annotating `X` with `#[derive(Ord)]` + | +LL | #[derive(Ord)] + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-20174.rs b/tests/ui/issues/issue-20174.rs new file mode 100644 index 000000000..4ed5a97c1 --- /dev/null +++ b/tests/ui/issues/issue-20174.rs @@ -0,0 +1,7 @@ +// run-pass +struct GradFn<F: Fn() -> usize>(F); + +fn main() { + let GradFn(x_squared) : GradFn<_> = GradFn(|| -> usize { 2 }); + let _ = x_squared(); +} diff --git a/tests/ui/issues/issue-20186.rs b/tests/ui/issues/issue-20186.rs new file mode 100644 index 000000000..54d68f100 --- /dev/null +++ b/tests/ui/issues/issue-20186.rs @@ -0,0 +1,16 @@ +// check-pass +#![allow(dead_code)] +#![allow(unused_variables)] +struct Foo; + +impl Foo { + fn putc(&self, b: u8) { } + + fn puts(&self, s: &str) { + for byte in s.bytes() { + self.putc(byte) + } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-20225.rs b/tests/ui/issues/issue-20225.rs new file mode 100644 index 000000000..0c8e6e402 --- /dev/null +++ b/tests/ui/issues/issue-20225.rs @@ -0,0 +1,22 @@ +#![feature(fn_traits, unboxed_closures)] + +struct Foo; + +impl<'a, T> Fn<(&'a T,)> for Foo { + extern "rust-call" fn call(&self, (_,): (T,)) {} + //~^ ERROR: has an incompatible type for trait +} + +impl<'a, T> FnMut<(&'a T,)> for Foo { + extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} + //~^ ERROR: has an incompatible type for trait +} + +impl<'a, T> FnOnce<(&'a T,)> for Foo { + type Output = (); + + extern "rust-call" fn call_once(self, (_,): (T,)) {} + //~^ ERROR: has an incompatible type for trait +} + +fn main() {} diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/issues/issue-20225.stderr new file mode 100644 index 000000000..582216010 --- /dev/null +++ b/tests/ui/issues/issue-20225.stderr @@ -0,0 +1,46 @@ +error[E0053]: method `call` has an incompatible type for trait + --> $DIR/issue-20225.rs:6:43 + | +LL | impl<'a, T> Fn<(&'a T,)> for Foo { + | - this type parameter +LL | extern "rust-call" fn call(&self, (_,): (T,)) {} + | ^^^^ + | | + | expected `&T`, found type parameter `T` + | help: change the parameter type to match the trait: `(&'a T,)` + | + = note: expected signature `extern "rust-call" fn(&Foo, (&'a T,))` + found signature `extern "rust-call" fn(&Foo, (T,))` + +error[E0053]: method `call_mut` has an incompatible type for trait + --> $DIR/issue-20225.rs:11:51 + | +LL | impl<'a, T> FnMut<(&'a T,)> for Foo { + | - this type parameter +LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} + | ^^^^ + | | + | expected `&T`, found type parameter `T` + | help: change the parameter type to match the trait: `(&'a T,)` + | + = note: expected signature `extern "rust-call" fn(&mut Foo, (&'a T,))` + found signature `extern "rust-call" fn(&mut Foo, (T,))` + +error[E0053]: method `call_once` has an incompatible type for trait + --> $DIR/issue-20225.rs:18:47 + | +LL | impl<'a, T> FnOnce<(&'a T,)> for Foo { + | - this type parameter +... +LL | extern "rust-call" fn call_once(self, (_,): (T,)) {} + | ^^^^ + | | + | expected `&T`, found type parameter `T` + | help: change the parameter type to match the trait: `(&'a T,)` + | + = note: expected signature `extern "rust-call" fn(Foo, (&'a T,))` + found signature `extern "rust-call" fn(Foo, (T,))` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/issues/issue-20261.rs b/tests/ui/issues/issue-20261.rs new file mode 100644 index 000000000..528393606 --- /dev/null +++ b/tests/ui/issues/issue-20261.rs @@ -0,0 +1,7 @@ +fn main() { + // N.B., this (almost) typechecks when default binding modes are enabled. + for (ref i,) in [].iter() { + i.clone(); + //~^ ERROR type annotations needed + } +} diff --git a/tests/ui/issues/issue-20261.stderr b/tests/ui/issues/issue-20261.stderr new file mode 100644 index 000000000..9ac751e4d --- /dev/null +++ b/tests/ui/issues/issue-20261.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/issue-20261.rs:4:11 + | +LL | i.clone(); + | ^^^^^ cannot infer type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-20313-rpass.rs b/tests/ui/issues/issue-20313-rpass.rs new file mode 100644 index 000000000..591f3659e --- /dev/null +++ b/tests/ui/issues/issue-20313-rpass.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 +#![feature(link_llvm_intrinsics)] + +extern "C" { + #[link_name = "llvm.sqrt.f32"] + fn sqrt(x: f32) -> f32; +} + +fn main() {} diff --git a/tests/ui/issues/issue-20313.rs b/tests/ui/issues/issue-20313.rs new file mode 100644 index 000000000..a72af650c --- /dev/null +++ b/tests/ui/issues/issue-20313.rs @@ -0,0 +1,6 @@ +extern "C" { + #[link_name = "llvm.sqrt.f32"] + fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental +} + +fn main() {} diff --git a/tests/ui/issues/issue-20313.stderr b/tests/ui/issues/issue-20313.stderr new file mode 100644 index 000000000..7a0b344a5 --- /dev/null +++ b/tests/ui/issues/issue-20313.stderr @@ -0,0 +1,12 @@ +error[E0658]: linking to LLVM intrinsics is experimental + --> $DIR/issue-20313.rs:3:5 + | +LL | fn sqrt(x: f32) -> f32; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #29602 <https://github.com/rust-lang/rust/issues/29602> for more information + = help: add `#![feature(link_llvm_intrinsics)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-20389.rs b/tests/ui/issues/issue-20389.rs new file mode 100644 index 000000000..9bc3efcc1 --- /dev/null +++ b/tests/ui/issues/issue-20389.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] +// aux-build:issue-20389.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_20389; + +struct Foo; + +impl issue_20389::T for Foo { + type C = (); +} + +fn main() {} diff --git a/tests/ui/issues/issue-20396.rs b/tests/ui/issues/issue-20396.rs new file mode 100644 index 000000000..4a34f8b38 --- /dev/null +++ b/tests/ui/issues/issue-20396.rs @@ -0,0 +1,16 @@ +// check-pass +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +trait Foo<T> { + fn noop(&self, _: T); +} + +enum Bar<T> { Bla(T) } + +struct Baz<'a> { + inner: dyn for<'b> Foo<Bar<&'b ()>> + 'a, +} + +fn main() {} diff --git a/tests/ui/issues/issue-20413.rs b/tests/ui/issues/issue-20413.rs new file mode 100644 index 000000000..4de22f0c9 --- /dev/null +++ b/tests/ui/issues/issue-20413.rs @@ -0,0 +1,42 @@ +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" +trait Foo { + fn answer(self); +} + +struct NoData<T>; +//~^ ERROR: parameter `T` is never used + +impl<T> Foo for T where NoData<T>: Foo { + //~^ ERROR: overflow evaluating the requirement + fn answer(self) { + let val: NoData<T> = NoData; + } +} + +trait Bar { + fn answer(self); +} + +trait Baz { + fn answer(self); +} + +struct AlmostNoData<T>(Option<T>); + +struct EvenLessData<T>(Option<T>); + +impl<T> Bar for T where EvenLessData<T>: Baz { +//~^ ERROR: overflow evaluating the requirement + fn answer(self) { + let val: EvenLessData<T> = EvenLessData(None); + } +} + +impl<T> Baz for T where AlmostNoData<T>: Bar { +//~^ ERROR: overflow evaluating the requirement + fn answer(self) { + let val: NoData<T> = AlmostNoData(None); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-20413.stderr b/tests/ui/issues/issue-20413.stderr new file mode 100644 index 000000000..202e84631 --- /dev/null +++ b/tests/ui/issues/issue-20413.stderr @@ -0,0 +1,73 @@ +error[E0392]: parameter `T` is never used + --> $DIR/issue-20413.rs:6:15 + | +LL | struct NoData<T>; + | ^ unused parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `T` to be a const parameter, use `const T: usize` instead + +error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<...>>>>>>>: Foo` + --> $DIR/issue-20413.rs:9:36 + | +LL | impl<T> Foo for T where NoData<T>: Foo { + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) +note: required for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<...>>>>>>>>>>>>>` to implement `Foo` + --> $DIR/issue-20413.rs:9:9 + | +LL | impl<T> Foo for T where NoData<T>: Foo { + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' + = note: 127 redundant requirements hidden + = note: required for `NoData<T>` to implement `Foo` + +error[E0275]: overflow evaluating the requirement `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>: Baz` + --> $DIR/issue-20413.rs:28:42 + | +LL | impl<T> Bar for T where EvenLessData<T>: Baz { + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) +note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>` to implement `Bar` + --> $DIR/issue-20413.rs:28:9 + | +LL | impl<T> Bar for T where EvenLessData<T>: Baz { + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' +note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>` to implement `Baz` + --> $DIR/issue-20413.rs:35:9 + | +LL | impl<T> Baz for T where AlmostNoData<T>: Bar { + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' + = note: 126 redundant requirements hidden + = note: required for `EvenLessData<T>` to implement `Baz` + +error[E0275]: overflow evaluating the requirement `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>: Bar` + --> $DIR/issue-20413.rs:35:42 + | +LL | impl<T> Baz for T where AlmostNoData<T>: Bar { + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) +note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>` to implement `Baz` + --> $DIR/issue-20413.rs:35:9 + | +LL | impl<T> Baz for T where AlmostNoData<T>: Bar { + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' +note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>` to implement `Bar` + --> $DIR/issue-20413.rs:28:9 + | +LL | impl<T> Bar for T where EvenLessData<T>: Baz { + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' + = note: 126 redundant requirements hidden + = note: required for `AlmostNoData<T>` to implement `Bar` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0275, E0392. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/issues/issue-20414.rs b/tests/ui/issues/issue-20414.rs new file mode 100644 index 000000000..2496e342a --- /dev/null +++ b/tests/ui/issues/issue-20414.rs @@ -0,0 +1,21 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait Trait { + fn method(self) -> isize; +} + +struct Wrapper<T> { + field: T +} + +impl<'a, T> Trait for &'a Wrapper<T> where &'a T: Trait { + fn method(self) -> isize { + let r: &'a T = &self.field; + Trait::method(r); // these should both work + r.method() + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-20427.rs b/tests/ui/issues/issue-20427.rs new file mode 100644 index 000000000..cfd8b2191 --- /dev/null +++ b/tests/ui/issues/issue-20427.rs @@ -0,0 +1,88 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(unused_imports)] +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(deprecated, deprecated_in_future)] + +// aux-build:i8.rs + +extern crate i8; +use std::string as i16; +static i32: i32 = 0; +const i64: i64 = 0; +fn u8(f32: f32) {} +fn f<f64>(f64: f64) {} +enum u32 {} +struct u64; +trait bool {} + +mod char { + extern crate i8; + static i32_: i32 = 0; + const i64_: i64 = 0; + fn u8_(f32: f32) {} + fn f_<f64_>(f64: f64_) {} + type u16_ = u16; + enum u32_ {} + struct u64_; + trait bool_ {} + mod char_ {} + + mod str { + use super::i8 as i8; + use super::i32_ as i32; + use super::i64_ as i64; + use super::u8_ as u8; + use super::f_ as f64; + use super::u16_ as u16; + use super::u32_ as u32; + use super::u64_ as u64; + use super::bool_ as bool; + use super::{bool_ as str}; + use super::char_ as char; + } +} + +trait isize_ { + type isize; +} + +fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize } + +mod reuse { + use std::mem::size_of; + + type u8 = u64; + use std::string::String as i16; + + pub fn check<u16>() { + assert_eq!(size_of::<u8>(), 8); + assert_eq!(size_of::<::u64>(), 0); + assert_eq!(size_of::<i16>(), 3 * size_of::<*const ()>()); + assert_eq!(size_of::<u16>(), 0); + } +} + +mod guard { + pub fn check() { + use std::u8; // bring module u8 in scope + fn f() -> u8 { // OK, resolves to primitive u8, not to std::u8 + u8::max_value() // OK, resolves to associated function <u8>::max_value, + // not to non-existent std::u8::max_value + } + assert_eq!(f(), u8::MAX); // OK, resolves to std::u8::MAX + } +} + +fn main() { + let bool = true; + let _ = match bool { + str @ true => if str { i32 as i64 } else { i64 }, + false => i64, + }; + + reuse::check::<u64>(); + guard::check(); +} diff --git a/tests/ui/issues/issue-20433.rs b/tests/ui/issues/issue-20433.rs new file mode 100644 index 000000000..a663239cc --- /dev/null +++ b/tests/ui/issues/issue-20433.rs @@ -0,0 +1,8 @@ +fn main() {} + +struct The; + +impl The { + fn iceman(c: Vec<[i32]>) {} + //~^ ERROR the size for values of type +} diff --git a/tests/ui/issues/issue-20433.stderr b/tests/ui/issues/issue-20433.stderr new file mode 100644 index 000000000..3ae952546 --- /dev/null +++ b/tests/ui/issues/issue-20433.stderr @@ -0,0 +1,13 @@ +error[E0277]: the size for values of type `[i32]` cannot be known at compilation time + --> $DIR/issue-20433.rs:6:18 + | +LL | fn iceman(c: Vec<[i32]>) {} + | ^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[i32]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-20454.rs b/tests/ui/issues/issue-20454.rs new file mode 100644 index 000000000..46cae33f1 --- /dev/null +++ b/tests/ui/issues/issue-20454.rs @@ -0,0 +1,13 @@ +// check-pass +#![allow(unused_must_use)] +use std::thread; + +fn _foo() { + thread::spawn(move || { // no need for -> () + loop { + println!("hello"); + } + }).join(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-20544.rs b/tests/ui/issues/issue-20544.rs new file mode 100644 index 000000000..0f4d314f1 --- /dev/null +++ b/tests/ui/issues/issue-20544.rs @@ -0,0 +1,18 @@ +// run-pass +#![feature(unboxed_closures)] +#![feature(fn_traits)] + +struct Fun<F>(F); + +impl<F, T> FnOnce<(T,)> for Fun<F> where F: Fn(T) -> T { + type Output = T; + + extern "rust-call" fn call_once(self, (t,): (T,)) -> T { + (self.0)(t) + } +} + +fn main() { + let fun = Fun(|i: isize| i * 2); + println!("{}", fun(3)); +} diff --git a/tests/ui/issues/issue-20575.rs b/tests/ui/issues/issue-20575.rs new file mode 100644 index 000000000..0ca67d9dc --- /dev/null +++ b/tests/ui/issues/issue-20575.rs @@ -0,0 +1,10 @@ +// run-pass +// Test that overloaded calls work with zero arity closures + +// pretty-expanded FIXME #23616 + +fn main() { + let functions: [Box<dyn Fn() -> Option<()>>; 1] = [Box::new(|| None)]; + + let _: Option<Vec<()>> = functions.iter().map(|f| (*f)()).collect(); +} diff --git a/tests/ui/issues/issue-20605.rs b/tests/ui/issues/issue-20605.rs new file mode 100644 index 000000000..17b7d32eb --- /dev/null +++ b/tests/ui/issues/issue-20605.rs @@ -0,0 +1,6 @@ +fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) { + for item in *things { *item = 0 } +//~^ ERROR the size for values of type +} + +fn main() {} diff --git a/tests/ui/issues/issue-20605.stderr b/tests/ui/issues/issue-20605.stderr new file mode 100644 index 000000000..e1858b639 --- /dev/null +++ b/tests/ui/issues/issue-20605.stderr @@ -0,0 +1,16 @@ +error[E0277]: the size for values of type `dyn Iterator<Item = &'a mut u8>` cannot be known at compilation time + --> $DIR/issue-20605.rs:2:17 + | +LL | for item in *things { *item = 0 } + | ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>` + | + = note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied + = note: required for `dyn Iterator<Item = &'a mut u8>` to implement `IntoIterator` +help: consider mutably borrowing here + | +LL | for item in &mut *things { *item = 0 } + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-20616.rs b/tests/ui/issues/issue-20616.rs new file mode 100644 index 000000000..6c24d4372 --- /dev/null +++ b/tests/ui/issues/issue-20616.rs @@ -0,0 +1,44 @@ +// run-pass +#![allow(dead_code)] +type MyType<'a, T> = &'a T; + +// combine lifetime bounds and type arguments in usual way +type TypeA<'a> = MyType<'a, ()>; + +// ensure token `>>` works fine +type TypeB = Box<TypeA<'static>>; +type TypeB_ = Box<TypeA<'static,>>; + +// trailing comma when combine lifetime bounds and type arguments +type TypeC<'a> = MyType<'a, (),>; + +// normal lifetime bounds +type TypeD = TypeA<'static>; + +// trailing comma on lifetime bounds +type TypeE = TypeA<'static,>; + +// normal type argument +type TypeF<T> = Box<T>; + +// type argument with trailing comma +type TypeG<T> = Box<T,>; + +// trailing comma on lifetime defs +type TypeH<'a,> = &'a (); + +// trailing comma on type argument +type TypeI<T,> = T; + +static STATIC: () = (); + +fn main() { + + // ensure token `>=` works fine + let _: TypeA<'static>= &STATIC; + let _: TypeA<'static,>= &STATIC; + + // ensure token `>>=` works fine + let _: Box<TypeA<'static>>= Box::new(&STATIC); + let _: Box<TypeA<'static,>>= Box::new(&STATIC); +} diff --git a/tests/ui/issues/issue-2063-resource.rs b/tests/ui/issues/issue-2063-resource.rs new file mode 100644 index 000000000..1d0527447 --- /dev/null +++ b/tests/ui/issues/issue-2063-resource.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +// test that autoderef of a type like this does not +// cause compiler to loop. Note that no instances +// of such a type could ever be constructed. + +struct S { + x: X, + to_str: (), +} + +struct X(Box<S>); + +fn main() {} diff --git a/tests/ui/issues/issue-2063.rs b/tests/ui/issues/issue-2063.rs new file mode 100644 index 000000000..f08f9d4cf --- /dev/null +++ b/tests/ui/issues/issue-2063.rs @@ -0,0 +1,22 @@ +// run-pass +// test that autoderef of a type like this does not +// cause compiler to loop. Note that no instances +// of such a type could ever be constructed. + +struct T(#[allow(unused_tuple_struct_fields)] Box<T>); + +trait ToStr2 { + fn my_to_string(&self) -> String; +} + +impl ToStr2 for T { + fn my_to_string(&self) -> String { "t".to_string() } +} + +#[allow(dead_code)] +fn new_t(x: T) { + x.my_to_string(); +} + +fn main() { +} diff --git a/tests/ui/issues/issue-20644.rs b/tests/ui/issues/issue-20644.rs new file mode 100644 index 000000000..1b90727fb --- /dev/null +++ b/tests/ui/issues/issue-20644.rs @@ -0,0 +1,32 @@ +// build-pass +#![allow(dead_code)] +#![allow(unused_imports)] +#![allow(stable_features)] + +// A reduced version of the rustbook ice. The problem this encountered +// had to do with codegen ignoring binders. + +// pretty-expanded FIXME #23616 + +#![feature(os)] + +use std::iter; +use std::os; +use std::fs::File; +use std::io::prelude::*; +use std::env; +use std::path::Path; + +pub fn parse_summary<R: Read>(_: R, _: &Path) { + let path_from_root = Path::new(""); + Path::new(&"../".repeat(path_from_root.components().count() - 1)); + } + +fn foo() { + let cwd = env::current_dir().unwrap(); + let src = cwd.clone(); + let summary = File::open(&src.join("SUMMARY.md")).unwrap(); + let _ = parse_summary(summary, &src); +} + +fn main() {} diff --git a/tests/ui/issues/issue-20676.rs b/tests/ui/issues/issue-20676.rs new file mode 100644 index 000000000..2bc503496 --- /dev/null +++ b/tests/ui/issues/issue-20676.rs @@ -0,0 +1,12 @@ +// run-pass +// Regression test for #20676. Error was that we didn't support +// UFCS-style calls to a method in `Trait` where `Self` was bound to a +// trait object of type `Trait`. See also `ufcs-trait-object.rs`. + + +use std::fmt; + +fn main() { + let a: &dyn fmt::Debug = &1; + format!("{:?}", a); +} diff --git a/tests/ui/issues/issue-20714.rs b/tests/ui/issues/issue-20714.rs new file mode 100644 index 000000000..3aa39bb73 --- /dev/null +++ b/tests/ui/issues/issue-20714.rs @@ -0,0 +1,5 @@ +struct G; + +fn main() { + let g = G(); //~ ERROR: expected function, found struct `G` +} diff --git a/tests/ui/issues/issue-20714.stderr b/tests/ui/issues/issue-20714.stderr new file mode 100644 index 000000000..a3447aa68 --- /dev/null +++ b/tests/ui/issues/issue-20714.stderr @@ -0,0 +1,20 @@ +error[E0618]: expected function, found struct `G` + --> $DIR/issue-20714.rs:4:13 + | +LL | struct G; + | -------- struct `G` defined here +... +LL | let g = G(); + | ^-- + | | + | call expression requires function + | +help: `G` is a unit struct, and does not take parentheses to be constructed + | +LL - let g = G(); +LL + let g = G; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-2074.rs b/tests/ui/issues/issue-2074.rs new file mode 100644 index 000000000..a6bea3858 --- /dev/null +++ b/tests/ui/issues/issue-2074.rs @@ -0,0 +1,16 @@ +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(non_camel_case_types)] + +pub fn main() { + let one = || { + enum r { a } + r::a as usize + }; + let two = || { + enum r { a } + r::a as usize + }; + one(); two(); +} diff --git a/tests/ui/issues/issue-20763-1.rs b/tests/ui/issues/issue-20763-1.rs new file mode 100644 index 000000000..858d313fc --- /dev/null +++ b/tests/ui/issues/issue-20763-1.rs @@ -0,0 +1,29 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait T0 { + type O; + fn dummy(&self) { } +} + +struct S<A>(A); +impl<A> T0 for S<A> { type O = A; } + +trait T1: T0 { + // this looks okay but as we see below, `f` is unusable + fn m0<F: Fn(<Self as T0>::O) -> bool>(self, f: F) -> bool; +} + +// complains about the bounds on F here not being required by the trait +impl<A> T1 for S<A> { + fn m0<F: Fn(A) -> bool>(self, f: F) -> bool { f(self.0) } +} + +// // complains about mismatched types: <S<A> as T0>::O vs. A +// impl<A> T1 for S<A> +// { +// fn m0<F: Fn(<Self as T0>::O) -> bool>(self, f: F) -> bool { f(self.0) } +// } + +fn main() { } diff --git a/tests/ui/issues/issue-20763-2.rs b/tests/ui/issues/issue-20763-2.rs new file mode 100644 index 000000000..aa5bed209 --- /dev/null +++ b/tests/ui/issues/issue-20763-2.rs @@ -0,0 +1,24 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait T0 { + type O; + fn dummy(&self) { } +} + +struct S<A>(A); +impl<A> T0 for S<A> { type O = A; } + +trait T1: T0 { + // this looks okay but as we see below, `f` is unusable + fn m0<F: Fn(<Self as T0>::O) -> bool>(self, f: F) -> bool; +} + +// complains about mismatched types: <S<A> as T0>::O vs. A +impl<A> T1 for S<A> +{ + fn m0<F: Fn(<Self as T0>::O) -> bool>(self, f: F) -> bool { f(self.0) } +} + +fn main() { } diff --git a/tests/ui/issues/issue-20772.rs b/tests/ui/issues/issue-20772.rs new file mode 100644 index 000000000..1500bc831 --- /dev/null +++ b/tests/ui/issues/issue-20772.rs @@ -0,0 +1,5 @@ +trait T : Iterator<Item=Self::Item> +//~^ ERROR cycle detected +{} + +fn main() {} diff --git a/tests/ui/issues/issue-20772.stderr b/tests/ui/issues/issue-20772.stderr new file mode 100644 index 000000000..22b9f5bd4 --- /dev/null +++ b/tests/ui/issues/issue-20772.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when computing the super traits of `T` with associated type name `Item` + --> $DIR/issue-20772.rs:1:1 + | +LL | trait T : Iterator<Item=Self::Item> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which immediately requires computing the super traits of `T` with associated type name `Item` again +note: cycle used when computing the super traits of `T` + --> $DIR/issue-20772.rs:1:1 + | +LL | trait T : Iterator<Item=Self::Item> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-20797.rs b/tests/ui/issues/issue-20797.rs new file mode 100644 index 000000000..ef0e72571 --- /dev/null +++ b/tests/ui/issues/issue-20797.rs @@ -0,0 +1,93 @@ +// build-pass + +// Regression test for #20797. + +use std::default::Default; +use std::io; +use std::fs; +use std::path::PathBuf; + +pub trait PathExtensions { + fn is_dir(&self) -> bool { false } +} + +impl PathExtensions for PathBuf {} + +/// A strategy for acquiring more subpaths to walk. +pub trait Strategy { + type P: PathExtensions; + /// Gets additional subpaths from a given path. + fn get_more(&self, item: &Self::P) -> io::Result<Vec<Self::P>>; + /// Determine whether a path should be walked further. + /// This is run against each item from `get_more()`. + fn prune(&self, p: &Self::P) -> bool; +} + +/// The basic fully-recursive strategy. Nothing is pruned. +#[derive(Copy, Clone, Default)] +pub struct Recursive; + +impl Strategy for Recursive { + type P = PathBuf; + fn get_more(&self, p: &PathBuf) -> io::Result<Vec<PathBuf>> { + Ok(fs::read_dir(p).unwrap().map(|s| s.unwrap().path()).collect()) + } + + fn prune(&self, _: &PathBuf) -> bool { false } +} + +/// A directory walker of `P` using strategy `S`. +pub struct Subpaths<S: Strategy> { + stack: Vec<S::P>, + strategy: S, +} + +impl<S: Strategy> Subpaths<S> { + /// Creates a directory walker with a root path and strategy. + pub fn new(p: &S::P, strategy: S) -> io::Result<Subpaths<S>> { + let stack = strategy.get_more(p)?; + Ok(Subpaths { stack: stack, strategy: strategy }) + } +} + +impl<S: Default + Strategy> Subpaths<S> { + /// Creates a directory walker with a root path and a default strategy. + pub fn walk(p: &S::P) -> io::Result<Subpaths<S>> { + Subpaths::new(p, Default::default()) + } +} + +impl<S: Default + Strategy> Default for Subpaths<S> { + fn default() -> Subpaths<S> { + Subpaths { stack: Vec::new(), strategy: Default::default() } + } +} + +impl<S: Strategy> Iterator for Subpaths<S> { + type Item = S::P; + fn next (&mut self) -> Option<S::P> { + let mut opt_path = self.stack.pop(); + while opt_path.is_some() && self.strategy.prune(opt_path.as_ref().unwrap()) { + opt_path = self.stack.pop(); + } + match opt_path { + Some(path) => { + if path.is_dir() { + let result = self.strategy.get_more(&path); + match result { + Ok(dirs) => { self.stack.extend(dirs); }, + Err(..) => { } + } + } + Some(path) + } + None => None, + } + } +} + +fn _foo() { + let _walker: Subpaths<Recursive> = Subpaths::walk(&PathBuf::from("/home")).unwrap(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-20803.rs b/tests/ui/issues/issue-20803.rs new file mode 100644 index 000000000..f657cf6cd --- /dev/null +++ b/tests/ui/issues/issue-20803.rs @@ -0,0 +1,10 @@ +// run-pass +use std::ops::Add; + +fn foo<T>(x: T) -> <i32 as Add<T>>::Output where i32: Add<T> { + 42i32 + x +} + +fn main() { + println!("{}", foo(0i32)); +} diff --git a/tests/ui/issues/issue-20831-debruijn.rs b/tests/ui/issues/issue-20831-debruijn.rs new file mode 100644 index 000000000..20d980763 --- /dev/null +++ b/tests/ui/issues/issue-20831-debruijn.rs @@ -0,0 +1,39 @@ +// Regression test for #20831: debruijn index account was thrown off +// by the (anonymous) lifetime in `<Self as Publisher>::Output` +// below. Note that changing to a named lifetime made the problem go +// away. + +use std::cell::RefCell; +use std::ops::{Shl, Shr}; + +pub trait Subscriber { + type Input; +} + +pub trait Publisher<'a> { + type Output; + fn subscribe(&mut self, _: Box<dyn Subscriber<Input=Self::Output> + 'a>); +} + +pub trait Processor<'a> : Subscriber + Publisher<'a> { } + +impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } + +struct MyStruct<'a> { + sub: Box<dyn Subscriber<Input=u64> + 'a> +} + +impl<'a> Publisher<'a> for MyStruct<'a> { + type Output = u64; + fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { + // Not obvious, but there is an implicit lifetime here -------^ + //~^^ ERROR cannot infer + // + // The fact that `Publisher` is using an implicit lifetime is + // what was causing the debruijn accounting to be off, so + // leave it that way! + self.sub = t; + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-20831-debruijn.stderr b/tests/ui/issues/issue-20831-debruijn.stderr new file mode 100644 index 000000000..c3af1f678 --- /dev/null +++ b/tests/ui/issues/issue-20831-debruijn.stderr @@ -0,0 +1,27 @@ +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements + --> $DIR/issue-20831-debruijn.rs:28:33 + | +LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/issue-20831-debruijn.rs:28:58 + | +LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...but the lifetime must also be valid for the lifetime `'a` as defined here... + --> $DIR/issue-20831-debruijn.rs:26:6 + | +LL | impl<'a> Publisher<'a> for MyStruct<'a> { + | ^^ +note: ...so that the types are compatible + --> $DIR/issue-20831-debruijn.rs:28:33 + | +LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `<MyStruct<'a> as Publisher<'_>>` + found `<MyStruct<'_> as Publisher<'_>>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0495`. diff --git a/tests/ui/issues/issue-20847.rs b/tests/ui/issues/issue-20847.rs new file mode 100644 index 000000000..0cd7edf89 --- /dev/null +++ b/tests/ui/issues/issue-20847.rs @@ -0,0 +1,12 @@ +// run-pass +#![feature(fn_traits)] + +use std::ops::Fn; + +fn say(x: u32, y: u32) { + println!("{} {}", x, y); +} + +fn main() { + Fn::call(&say, (1, 2)); +} diff --git a/tests/ui/issues/issue-20939.rs b/tests/ui/issues/issue-20939.rs new file mode 100644 index 000000000..c0c222978 --- /dev/null +++ b/tests/ui/issues/issue-20939.rs @@ -0,0 +1,6 @@ +trait Foo {} + +impl<'a> Foo for dyn Foo + 'a {} +//~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` + +fn main() {} diff --git a/tests/ui/issues/issue-20939.stderr b/tests/ui/issues/issue-20939.stderr new file mode 100644 index 000000000..3819a21a2 --- /dev/null +++ b/tests/ui/issues/issue-20939.stderr @@ -0,0 +1,9 @@ +error[E0371]: the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` + --> $DIR/issue-20939.rs:3:1 + | +LL | impl<'a> Foo for dyn Foo + 'a {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0371`. diff --git a/tests/ui/issues/issue-20953.rs b/tests/ui/issues/issue-20953.rs new file mode 100644 index 000000000..4ec7e3195 --- /dev/null +++ b/tests/ui/issues/issue-20953.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] +fn main() { + let mut shrinker: Box<dyn Iterator<Item=i32>> = Box::new(vec![1].into_iter()); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } + + let mut shrinker: &mut dyn Iterator<Item=i32> = &mut vec![1].into_iter(); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } +} diff --git a/tests/ui/issues/issue-20971.rs b/tests/ui/issues/issue-20971.rs new file mode 100644 index 000000000..2e1041817 --- /dev/null +++ b/tests/ui/issues/issue-20971.rs @@ -0,0 +1,23 @@ +// Regression test for Issue #20971. + +// run-fail +// error-pattern:Hello, world! +// ignore-emscripten no processes + +pub trait Parser { + type Input; + fn parse(&mut self, input: <Self as Parser>::Input); +} + +impl Parser for () { + type Input = (); + fn parse(&mut self, input: ()) {} +} + +pub fn many() -> Box<dyn Parser<Input = <() as Parser>::Input> + 'static> { + panic!("Hello, world!") +} + +fn main() { + many().parse(()); +} diff --git a/tests/ui/issues/issue-21033.rs b/tests/ui/issues/issue-21033.rs new file mode 100644 index 000000000..91f72eb36 --- /dev/null +++ b/tests/ui/issues/issue-21033.rs @@ -0,0 +1,48 @@ +// run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +#![feature(box_patterns)] + +enum E { + StructVar { boxed: Box<i32> } +} + +fn main() { + + // Test matching each shorthand notation for field patterns. + let mut a = E::StructVar { boxed: Box::new(3) }; + match a { + E::StructVar { box boxed } => { } + } + match a { + E::StructVar { box ref boxed } => { } + } + match a { + E::StructVar { box mut boxed } => { } + } + match a { + E::StructVar { box ref mut boxed } => { } + } + match a { + E::StructVar { ref boxed } => { } + } + match a { + E::StructVar { ref mut boxed } => { } + } + match a { + E::StructVar { mut boxed } => { } + } + + // Test matching non shorthand notation. Recreate a since last test + // moved `boxed` + let mut a = E::StructVar { boxed: Box::new(3) }; + match a { + E::StructVar { boxed: box ref mut num } => { } + } + match a { + E::StructVar { boxed: ref mut num } => { } + } + +} diff --git a/tests/ui/issues/issue-21140.rs b/tests/ui/issues/issue-21140.rs new file mode 100644 index 000000000..01de90111 --- /dev/null +++ b/tests/ui/issues/issue-21140.rs @@ -0,0 +1,6 @@ +// check-pass +pub trait Trait where Self::Out: std::fmt::Display { + type Out; +} + +fn main() {} diff --git a/tests/ui/issues/issue-21160.rs b/tests/ui/issues/issue-21160.rs new file mode 100644 index 000000000..10136ba11 --- /dev/null +++ b/tests/ui/issues/issue-21160.rs @@ -0,0 +1,11 @@ +struct Bar; + +impl Bar { + fn hash<T>(&self, _: T) {} +} + +#[derive(Hash)] +struct Foo(Bar); +//~^ error: `Bar: Hash` is not satisfied + +fn main() {} diff --git a/tests/ui/issues/issue-21160.stderr b/tests/ui/issues/issue-21160.stderr new file mode 100644 index 000000000..266749376 --- /dev/null +++ b/tests/ui/issues/issue-21160.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `Bar: Hash` is not satisfied + --> $DIR/issue-21160.rs:8:12 + | +LL | #[derive(Hash)] + | ---- in this derive macro expansion +LL | struct Foo(Bar); + | ^^^ the trait `Hash` is not implemented for `Bar` + | + = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `Bar` with `#[derive(Hash)]` + | +LL | #[derive(Hash)] + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-21174-2.rs b/tests/ui/issues/issue-21174-2.rs new file mode 100644 index 000000000..c90f91f6a --- /dev/null +++ b/tests/ui/issues/issue-21174-2.rs @@ -0,0 +1,13 @@ +// check-pass +#![allow(dead_code)] +#![allow(unused_variables)] +trait Trait<'a> { + type A; + type B; +} + +fn foo<'a, T: Trait<'a>>(value: T::A) { + let new: T::B = unsafe { std::mem::transmute_copy(&value) }; +} + +fn main() { } diff --git a/tests/ui/issues/issue-21174.rs b/tests/ui/issues/issue-21174.rs new file mode 100644 index 000000000..078274251 --- /dev/null +++ b/tests/ui/issues/issue-21174.rs @@ -0,0 +1,11 @@ +trait Trait<'a> { + type A; + type B; +} + +fn foo<'a, T: Trait<'a>>(value: T::A) { + let new: T::B = unsafe { std::mem::transmute(value) }; +//~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types +} + +fn main() { } diff --git a/tests/ui/issues/issue-21174.stderr b/tests/ui/issues/issue-21174.stderr new file mode 100644 index 000000000..5981d9dc7 --- /dev/null +++ b/tests/ui/issues/issue-21174.stderr @@ -0,0 +1,12 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-21174.rs:7:30 + | +LL | let new: T::B = unsafe { std::mem::transmute(value) }; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `<T as Trait<'_>>::A` (this type does not have a fixed size) + = note: target type: `<T as Trait<'_>>::B` (this type does not have a fixed size) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/issues/issue-21177.rs b/tests/ui/issues/issue-21177.rs new file mode 100644 index 000000000..258e362d1 --- /dev/null +++ b/tests/ui/issues/issue-21177.rs @@ -0,0 +1,9 @@ +trait Trait { + type A; + type B; +} + +fn foo<T: Trait<A = T::B>>() { } +//~^ ERROR cycle detected + +fn main() { } diff --git a/tests/ui/issues/issue-21177.stderr b/tests/ui/issues/issue-21177.stderr new file mode 100644 index 000000000..6877a1846 --- /dev/null +++ b/tests/ui/issues/issue-21177.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when computing the bounds for type parameter `T` + --> $DIR/issue-21177.rs:6:21 + | +LL | fn foo<T: Trait<A = T::B>>() { } + | ^^^^ + | + = note: ...which immediately requires computing the bounds for type parameter `T` again +note: cycle used when computing explicit predicates of `foo` + --> $DIR/issue-21177.rs:6:21 + | +LL | fn foo<T: Trait<A = T::B>>() { } + | ^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-21202.rs b/tests/ui/issues/issue-21202.rs new file mode 100644 index 000000000..f62de7ce7 --- /dev/null +++ b/tests/ui/issues/issue-21202.rs @@ -0,0 +1,15 @@ +// aux-build:issue-21202.rs + +extern crate issue_21202 as crate1; + +use crate1::A; + +mod B { + use crate1::A::Foo; + fn bar(f: Foo) { + Foo::foo(&f); + //~^ ERROR: associated function `foo` is private + } +} + +fn main() { } diff --git a/tests/ui/issues/issue-21202.stderr b/tests/ui/issues/issue-21202.stderr new file mode 100644 index 000000000..1d2816fed --- /dev/null +++ b/tests/ui/issues/issue-21202.stderr @@ -0,0 +1,14 @@ +error[E0624]: associated function `foo` is private + --> $DIR/issue-21202.rs:10:14 + | +LL | Foo::foo(&f); + | ^^^ private associated function + | + ::: $DIR/auxiliary/issue-21202.rs:4:9 + | +LL | fn foo(&self) { } + | ------------- private associated function defined here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/issues/issue-21245.rs b/tests/ui/issues/issue-21245.rs new file mode 100644 index 000000000..c8e55a0cc --- /dev/null +++ b/tests/ui/issues/issue-21245.rs @@ -0,0 +1,56 @@ +// check-pass +#![allow(dead_code)] +// Regression test for issue #21245. Check that we are able to infer +// the types in these examples correctly. It used to be that +// insufficient type propagation caused the type of the iterator to be +// incorrectly unified with the `*const` type to which it is coerced. + +// pretty-expanded FIXME #23616 + +use std::ptr; + +trait IntoIterator { + type Iter: Iterator; + + fn into_iter2(self) -> Self::Iter; +} + +impl<I> IntoIterator for I where I: Iterator { + type Iter = I; + + fn into_iter2(self) -> I { + self + } +} + +fn desugared_for_loop_bad<T>(v: Vec<T>) { + match IntoIterator::into_iter2(v.iter()) { + mut iter => { + loop { + match ::std::iter::Iterator::next(&mut iter) { + ::std::option::Option::Some(x) => { + unsafe { ptr::read(x); } + }, + ::std::option::Option::None => break + } + } + } + } +} + +fn desugared_for_loop_good<T>(v: Vec<T>) { + match v.iter().into_iter() { + mut iter => { + loop { + match ::std::iter::Iterator::next(&mut iter) { + ::std::option::Option::Some(x) => { + unsafe { ptr::read(x); } + }, + ::std::option::Option::None => break + } + } + } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-21291.rs b/tests/ui/issues/issue-21291.rs new file mode 100644 index 000000000..b351e22d8 --- /dev/null +++ b/tests/ui/issues/issue-21291.rs @@ -0,0 +1,10 @@ +// run-pass +// ignore-emscripten no threads support + +// Regression test for unwrapping the result of `join`, issue #21291 + +use std::thread; + +fn main() { + thread::spawn(|| {}).join().unwrap() +} diff --git a/tests/ui/issues/issue-21306.rs b/tests/ui/issues/issue-21306.rs new file mode 100644 index 000000000..b06a475e4 --- /dev/null +++ b/tests/ui/issues/issue-21306.rs @@ -0,0 +1,9 @@ +// run-pass + +use std::sync::Arc; + +fn main() { + let x = 5; + let command = Arc::new(Box::new(|| { x*2 })); + assert_eq!(command(), 10); +} diff --git a/tests/ui/issues/issue-21332.rs b/tests/ui/issues/issue-21332.rs new file mode 100644 index 000000000..6547f3a9b --- /dev/null +++ b/tests/ui/issues/issue-21332.rs @@ -0,0 +1,10 @@ +struct S; + +impl Iterator for S { + type Item = i32; + fn next(&mut self) -> Result<i32, i32> { Ok(7) } + //~^ ERROR method `next` has an incompatible type for trait + //~| expected enum `Option`, found enum `Result` +} + +fn main() {} diff --git a/tests/ui/issues/issue-21332.stderr b/tests/ui/issues/issue-21332.stderr new file mode 100644 index 000000000..0e1beebf2 --- /dev/null +++ b/tests/ui/issues/issue-21332.stderr @@ -0,0 +1,15 @@ +error[E0053]: method `next` has an incompatible type for trait + --> $DIR/issue-21332.rs:5:27 + | +LL | fn next(&mut self) -> Result<i32, i32> { Ok(7) } + | ^^^^^^^^^^^^^^^^ + | | + | expected enum `Option`, found enum `Result` + | help: change the output type to match the trait: `Option<i32>` + | + = note: expected signature `fn(&mut S) -> Option<i32>` + found signature `fn(&mut S) -> Result<i32, i32>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/issues/issue-21361.rs b/tests/ui/issues/issue-21361.rs new file mode 100644 index 000000000..c970e77ab --- /dev/null +++ b/tests/ui/issues/issue-21361.rs @@ -0,0 +1,11 @@ +// run-pass + +fn main() { + let v = vec![1, 2, 3]; + let boxed: Box<dyn Iterator<Item=i32>> = Box::new(v.into_iter()); + assert_eq!(boxed.max(), Some(3)); + + let v = vec![1, 2, 3]; + let boxed: &mut dyn Iterator<Item=i32> = &mut v.into_iter(); + assert_eq!(boxed.max(), Some(3)); +} diff --git a/tests/ui/issues/issue-21384.rs b/tests/ui/issues/issue-21384.rs new file mode 100644 index 000000000..caa99a159 --- /dev/null +++ b/tests/ui/issues/issue-21384.rs @@ -0,0 +1,21 @@ +// run-pass + +use ::std::ops::RangeFull; + +fn test<T : Clone>(arg: T) -> T { + arg.clone() +} + +#[derive(PartialEq, Debug)] +struct Test(isize); + +fn main() { + // Check that ranges implement clone + assert_eq!(test(1..5), (1..5)); + assert_eq!(test(..5), (..5)); + assert_eq!(test(1..), (1..)); + assert_eq!(test(RangeFull), (RangeFull)); + + // Check that ranges can still be used with non-clone limits + assert_eq!((Test(1)..Test(5)), (Test(1)..Test(5))); +} diff --git a/tests/ui/issues/issue-21400.rs b/tests/ui/issues/issue-21400.rs new file mode 100644 index 000000000..4a85158d9 --- /dev/null +++ b/tests/ui/issues/issue-21400.rs @@ -0,0 +1,56 @@ +// run-pass +// Regression test for #21400 which itself was extracted from +// stackoverflow.com/questions/28031155/is-my-borrow-checker-drunk/28031580 + +fn main() { + let mut t = Test; + assert_eq!(t.method1("one"), Ok(1)); + assert_eq!(t.method2("two"), Ok(2)); + assert_eq!(t.test(), Ok(2)); +} + +struct Test; + +impl Test { + fn method1(&mut self, _arg: &str) -> Result<usize, &str> { + Ok(1) + } + + fn method2(self: &mut Test, _arg: &str) -> Result<usize, &str> { + Ok(2) + } + + fn test(self: &mut Test) -> Result<usize, &str> { + let s = format!("abcde"); + // (Originally, this invocation of method2 was saying that `s` + // does not live long enough.) + let data = match self.method2(&*s) { + Ok(r) => r, + Err(e) => return Err(e) + }; + Ok(data) + } +} + +// Below is a closer match for the original test that was failing to compile + +pub struct GitConnect; + +impl GitConnect { + fn command(self: &mut GitConnect, _s: &str) -> Result<Vec<Vec<u8>>, &str> { + unimplemented!() + } + + pub fn git_upload_pack(self: &mut GitConnect) -> Result<String, &str> { + let c = format!("git-upload-pack"); + + let mut out = String::new(); + let data = self.command(&c)?; + + for line in data.iter() { + out.push_str(&format!("{:?}", line)); + } + + Ok(out) + } +} diff --git a/tests/ui/issues/issue-21402.rs b/tests/ui/issues/issue-21402.rs new file mode 100644 index 000000000..d140b6162 --- /dev/null +++ b/tests/ui/issues/issue-21402.rs @@ -0,0 +1,12 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +#[derive(Hash)] +struct Foo { + a: Vec<bool>, + b: (bool, bool), + c: [bool; 2], +} + +fn main() {} diff --git a/tests/ui/issues/issue-21449.rs b/tests/ui/issues/issue-21449.rs new file mode 100644 index 000000000..00ce2b7ff --- /dev/null +++ b/tests/ui/issues/issue-21449.rs @@ -0,0 +1,6 @@ +mod MyMod {} + +fn main() { + let myVar = MyMod { T: 0 }; + //~^ ERROR expected struct, variant or union type, found module `MyMod` +} diff --git a/tests/ui/issues/issue-21449.stderr b/tests/ui/issues/issue-21449.stderr new file mode 100644 index 000000000..ecaf6faba --- /dev/null +++ b/tests/ui/issues/issue-21449.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found module `MyMod` + --> $DIR/issue-21449.rs:4:17 + | +LL | let myVar = MyMod { T: 0 }; + | ^^^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/tests/ui/issues/issue-2150.rs b/tests/ui/issues/issue-2150.rs new file mode 100644 index 000000000..baa1dde0f --- /dev/null +++ b/tests/ui/issues/issue-2150.rs @@ -0,0 +1,12 @@ +#![deny(unreachable_code)] +#![allow(unused_variables)] +#![allow(dead_code)] + +fn fail_len(v: Vec<isize> ) -> usize { + let mut i = 3; + panic!(); + for x in &v { i += 1; } + //~^ ERROR: unreachable statement + return i; +} +fn main() {} diff --git a/tests/ui/issues/issue-2150.stderr b/tests/ui/issues/issue-2150.stderr new file mode 100644 index 000000000..26874faa2 --- /dev/null +++ b/tests/ui/issues/issue-2150.stderr @@ -0,0 +1,16 @@ +error: unreachable statement + --> $DIR/issue-2150.rs:8:5 + | +LL | panic!(); + | -------- any code following this expression is unreachable +LL | for x in &v { i += 1; } + | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement + | +note: the lint level is defined here + --> $DIR/issue-2150.rs:1:9 + | +LL | #![deny(unreachable_code)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-2151.rs b/tests/ui/issues/issue-2151.rs new file mode 100644 index 000000000..82cf49de8 --- /dev/null +++ b/tests/ui/issues/issue-2151.rs @@ -0,0 +1,4 @@ +fn main() { + let x = panic!(); //~ ERROR type annotations needed + x.clone(); +} diff --git a/tests/ui/issues/issue-2151.stderr b/tests/ui/issues/issue-2151.stderr new file mode 100644 index 000000000..c75038b61 --- /dev/null +++ b/tests/ui/issues/issue-2151.stderr @@ -0,0 +1,16 @@ +error[E0282]: type annotations needed + --> $DIR/issue-2151.rs:2:9 + | +LL | let x = panic!(); + | ^ +LL | x.clone(); + | - type must be known at this point + | +help: consider giving `x` an explicit type + | +LL | let x: /* Type */ = panic!(); + | ++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-21546.rs b/tests/ui/issues/issue-21546.rs new file mode 100644 index 000000000..9f3974b43 --- /dev/null +++ b/tests/ui/issues/issue-21546.rs @@ -0,0 +1,49 @@ +// Also works as a test for #14564 + +#[allow(non_snake_case)] +mod Foo { } + +#[allow(dead_code)] +struct Foo; +//~^ ERROR the name `Foo` is defined multiple times + +#[allow(non_snake_case)] +mod Bar { } + +#[allow(dead_code)] +struct Bar(i32); +//~^ ERROR the name `Bar` is defined multiple times + + +#[allow(dead_code)] +struct Baz(i32); + +#[allow(non_snake_case)] +mod Baz { } +//~^ ERROR the name `Baz` is defined multiple times + + +#[allow(dead_code)] +struct Qux { x: bool } + +#[allow(non_snake_case)] +mod Qux { } +//~^ ERROR the name `Qux` is defined multiple times + + +#[allow(dead_code)] +struct Quux; + +#[allow(non_snake_case)] +mod Quux { } +//~^ ERROR the name `Quux` is defined multiple times + + +#[allow(dead_code)] +enum Corge { A, B } + +#[allow(non_snake_case)] +mod Corge { } +//~^ ERROR the name `Corge` is defined multiple times + +fn main() { } diff --git a/tests/ui/issues/issue-21546.stderr b/tests/ui/issues/issue-21546.stderr new file mode 100644 index 000000000..5fd06fc67 --- /dev/null +++ b/tests/ui/issues/issue-21546.stderr @@ -0,0 +1,69 @@ +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/issue-21546.rs:7:1 + | +LL | mod Foo { } + | ------- previous definition of the module `Foo` here +... +LL | struct Foo; + | ^^^^^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Bar` is defined multiple times + --> $DIR/issue-21546.rs:14:1 + | +LL | mod Bar { } + | ------- previous definition of the module `Bar` here +... +LL | struct Bar(i32); + | ^^^^^^^^^^^^^^^^ `Bar` redefined here + | + = note: `Bar` must be defined only once in the type namespace of this module + +error[E0428]: the name `Baz` is defined multiple times + --> $DIR/issue-21546.rs:22:1 + | +LL | struct Baz(i32); + | ---------------- previous definition of the type `Baz` here +... +LL | mod Baz { } + | ^^^^^^^ `Baz` redefined here + | + = note: `Baz` must be defined only once in the type namespace of this module + +error[E0428]: the name `Qux` is defined multiple times + --> $DIR/issue-21546.rs:30:1 + | +LL | struct Qux { x: bool } + | ---------- previous definition of the type `Qux` here +... +LL | mod Qux { } + | ^^^^^^^ `Qux` redefined here + | + = note: `Qux` must be defined only once in the type namespace of this module + +error[E0428]: the name `Quux` is defined multiple times + --> $DIR/issue-21546.rs:38:1 + | +LL | struct Quux; + | ------------ previous definition of the type `Quux` here +... +LL | mod Quux { } + | ^^^^^^^^ `Quux` redefined here + | + = note: `Quux` must be defined only once in the type namespace of this module + +error[E0428]: the name `Corge` is defined multiple times + --> $DIR/issue-21546.rs:46:1 + | +LL | enum Corge { A, B } + | ---------- previous definition of the type `Corge` here +... +LL | mod Corge { } + | ^^^^^^^^^ `Corge` redefined here + | + = note: `Corge` must be defined only once in the type namespace of this module + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-21554.rs b/tests/ui/issues/issue-21554.rs new file mode 100644 index 000000000..c176b1247 --- /dev/null +++ b/tests/ui/issues/issue-21554.rs @@ -0,0 +1,6 @@ +struct Inches(i32); + +fn main() { + Inches as f32; + //~^ ERROR casting +} diff --git a/tests/ui/issues/issue-21554.stderr b/tests/ui/issues/issue-21554.stderr new file mode 100644 index 000000000..6ea552a26 --- /dev/null +++ b/tests/ui/issues/issue-21554.stderr @@ -0,0 +1,9 @@ +error[E0606]: casting `fn(i32) -> Inches {Inches}` as `f32` is invalid + --> $DIR/issue-21554.rs:4:5 + | +LL | Inches as f32; + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0606`. diff --git a/tests/ui/issues/issue-21596.rs b/tests/ui/issues/issue-21596.rs new file mode 100644 index 000000000..79f6c91d9 --- /dev/null +++ b/tests/ui/issues/issue-21596.rs @@ -0,0 +1,5 @@ +fn main() { + let x = 8u8; + let z: *const u8 = &x; + println!("{}", z.to_string()); //~ ERROR E0599 +} diff --git a/tests/ui/issues/issue-21596.stderr b/tests/ui/issues/issue-21596.stderr new file mode 100644 index 000000000..a336d1b0e --- /dev/null +++ b/tests/ui/issues/issue-21596.stderr @@ -0,0 +1,15 @@ +error[E0599]: `*const u8` doesn't implement `std::fmt::Display` + --> $DIR/issue-21596.rs:4:22 + | +LL | println!("{}", z.to_string()); + | ^^^^^^^^^ `*const u8` cannot be formatted with the default formatter + | + = note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref + = note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior + = note: the following trait bounds were not satisfied: + `*const u8: std::fmt::Display` + which is required by `*const u8: ToString` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-21600.rs b/tests/ui/issues/issue-21600.rs new file mode 100644 index 000000000..2e22e5e6f --- /dev/null +++ b/tests/ui/issues/issue-21600.rs @@ -0,0 +1,18 @@ +fn call_it<F>(f: F) where F: Fn() { f(); } + +struct A; + +impl A { + fn gen(&self) {} + fn gen_mut(&mut self) {} +} + +fn main() { + let mut x = A; + call_it(|| { + call_it(|| x.gen()); + call_it(|| x.gen_mut()); + //~^ ERROR cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure + //~| ERROR cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure + }); +} diff --git a/tests/ui/issues/issue-21600.stderr b/tests/ui/issues/issue-21600.stderr new file mode 100644 index 000000000..ea304f936 --- /dev/null +++ b/tests/ui/issues/issue-21600.stderr @@ -0,0 +1,31 @@ +error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure + --> $DIR/issue-21600.rs:14:20 + | +LL | fn call_it<F>(f: F) where F: Fn() { f(); } + | - change this to accept `FnMut` instead of `Fn` +... +LL | call_it(|| x.gen_mut()); + | ------- -- ^^^^^^^^^^^ cannot borrow as mutable + | | | + | | in this closure + | expects `Fn` instead of `FnMut` + +error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure + --> $DIR/issue-21600.rs:14:17 + | +LL | fn call_it<F>(f: F) where F: Fn() { f(); } + | - change this to accept `FnMut` instead of `Fn` +... +LL | call_it(|| { + | ------- -- in this closure + | | + | expects `Fn` instead of `FnMut` +LL | call_it(|| x.gen()); +LL | call_it(|| x.gen_mut()); + | ^^ - mutable borrow occurs due to use of `x` in closure + | | + | cannot borrow as mutable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/issues/issue-21622.rs b/tests/ui/issues/issue-21622.rs new file mode 100644 index 000000000..2d4cddac9 --- /dev/null +++ b/tests/ui/issues/issue-21622.rs @@ -0,0 +1,21 @@ +// check-pass +#![allow(dead_code)] +#![allow(unused_variables)] + +struct Index; + +impl Index { + fn new() -> Self { Index } +} + +fn user() { + let new = Index::new; + + fn inner() { + let index = Index::new(); + } + + let index2 = new(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-21634.rs b/tests/ui/issues/issue-21634.rs new file mode 100644 index 000000000..2731bfd76 --- /dev/null +++ b/tests/ui/issues/issue-21634.rs @@ -0,0 +1,20 @@ +// run-pass +#![allow(stable_features)] + +#![feature(cfg_target_feature)] + +#[cfg(any(not(target_arch = "x86"), target_feature = "sse2"))] +fn main() { + if let Ok(x) = "3.1415".parse::<f64>() { + assert_eq!(false, x <= 0.0); + } + if let Ok(x) = "3.1415".parse::<f64>() { + assert_eq!(3.1415, x + 0.0); + } + if let Ok(mut x) = "3.1415".parse::<f64>() { + assert_eq!(8.1415, { x += 5.0; x }); + } +} + +#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))] +fn main() {} diff --git a/tests/ui/issues/issue-21655.rs b/tests/ui/issues/issue-21655.rs new file mode 100644 index 000000000..d1cd4ec7b --- /dev/null +++ b/tests/ui/issues/issue-21655.rs @@ -0,0 +1,12 @@ +// run-pass + +fn test(it: &mut dyn Iterator<Item=i32>) { + for x in it { + assert_eq!(x, 1) + } +} + +fn main() { + let v = vec![1]; + test(&mut v.into_iter()) +} diff --git a/tests/ui/issues/issue-2170-exe.rs b/tests/ui/issues/issue-2170-exe.rs new file mode 100644 index 000000000..a89579706 --- /dev/null +++ b/tests/ui/issues/issue-2170-exe.rs @@ -0,0 +1,9 @@ +// run-pass +// aux-build:issue-2170-lib.rs +// pretty-expanded FIXME #23616 + +extern crate issue_2170_lib; + +pub fn main() { + // let _ = issue_2170_lib::rsrc(2); +} diff --git a/tests/ui/issues/issue-21701.rs b/tests/ui/issues/issue-21701.rs new file mode 100644 index 000000000..bfa03c5e4 --- /dev/null +++ b/tests/ui/issues/issue-21701.rs @@ -0,0 +1,15 @@ +fn foo<U>(t: U) { + let y = t(); +//~^ ERROR: expected function, found `U` +} + +struct Bar; + +pub fn some_func() { + let f = Bar(); +//~^ ERROR: expected function, found struct `Bar` +} + +fn main() { + foo(|| { 1 }); +} diff --git a/tests/ui/issues/issue-21701.stderr b/tests/ui/issues/issue-21701.stderr new file mode 100644 index 000000000..9f1fe7dde --- /dev/null +++ b/tests/ui/issues/issue-21701.stderr @@ -0,0 +1,30 @@ +error[E0618]: expected function, found `U` + --> $DIR/issue-21701.rs:2:13 + | +LL | fn foo<U>(t: U) { + | - `t` has type `U` +LL | let y = t(); + | ^-- + | | + | call expression requires function + +error[E0618]: expected function, found struct `Bar` + --> $DIR/issue-21701.rs:9:13 + | +LL | struct Bar; + | ---------- struct `Bar` defined here +... +LL | let f = Bar(); + | ^^^-- + | | + | call expression requires function + | +help: `Bar` is a unit struct, and does not take parentheses to be constructed + | +LL - let f = Bar(); +LL + let f = Bar; + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs new file mode 100644 index 000000000..5beb1d8b8 --- /dev/null +++ b/tests/ui/issues/issue-21763.rs @@ -0,0 +1,11 @@ +// Regression test for HashMap only impl'ing Send/Sync if its contents do + +use std::collections::HashMap; +use std::rc::Rc; + +fn foo<T: Send>() {} + +fn main() { + foo::<HashMap<Rc<()>, Rc<()>>>(); + //~^ ERROR `Rc<()>` cannot be sent between threads safely +} diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/issues/issue-21763.stderr new file mode 100644 index 000000000..04379f07b --- /dev/null +++ b/tests/ui/issues/issue-21763.stderr @@ -0,0 +1,20 @@ +error[E0277]: `Rc<()>` cannot be sent between threads safely + --> $DIR/issue-21763.rs:9:11 + | +LL | foo::<HashMap<Rc<()>, Rc<()>>>(); + | ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely + | + = help: within `(Rc<()>, Rc<()>)`, the trait `Send` is not implemented for `Rc<()>` + = note: required because it appears within the type `(Rc<()>, Rc<()>)` + = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send` + = note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>` + = note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>` +note: required by a bound in `foo` + --> $DIR/issue-21763.rs:6:11 + | +LL | fn foo<T: Send>() {} + | ^^^^ required by this bound in `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-21837.rs b/tests/ui/issues/issue-21837.rs new file mode 100644 index 000000000..213119bd2 --- /dev/null +++ b/tests/ui/issues/issue-21837.rs @@ -0,0 +1,10 @@ +pub trait Bound {} +pub struct Foo<T: Bound>(T); + +pub trait Trait1 {} +impl<T: Bound> Trait1 for Foo<T> {} + +pub trait Trait2 {} +impl<T> Trait2 for Foo<T> {} //~ ERROR the trait bound `T: Bound` is not satisfied + +fn main() {} diff --git a/tests/ui/issues/issue-21837.stderr b/tests/ui/issues/issue-21837.stderr new file mode 100644 index 000000000..3d3852664 --- /dev/null +++ b/tests/ui/issues/issue-21837.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `T: Bound` is not satisfied + --> $DIR/issue-21837.rs:8:20 + | +LL | impl<T> Trait2 for Foo<T> {} + | ^^^^^^ the trait `Bound` is not implemented for `T` + | +note: required by a bound in `Foo` + --> $DIR/issue-21837.rs:2:19 + | +LL | pub struct Foo<T: Bound>(T); + | ^^^^^ required by this bound in `Foo` +help: consider restricting type parameter `T` + | +LL | impl<T: Bound> Trait2 for Foo<T> {} + | +++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-21891.rs b/tests/ui/issues/issue-21891.rs new file mode 100644 index 000000000..576f0253e --- /dev/null +++ b/tests/ui/issues/issue-21891.rs @@ -0,0 +1,12 @@ +// build-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 + +static foo: [usize; 3] = [1, 2, 3]; + +static slice_1: &'static [usize] = &foo; +static slice_2: &'static [usize] = &foo; + +fn main() {} diff --git a/tests/ui/issues/issue-2190-1.rs b/tests/ui/issues/issue-2190-1.rs new file mode 100644 index 000000000..e67a924b9 --- /dev/null +++ b/tests/ui/issues/issue-2190-1.rs @@ -0,0 +1,26 @@ +// run-pass +#![allow(unused_must_use)] +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 +// ignore-emscripten no threads + +use std::thread::Builder; + +static generations: usize = 1024+256+128+49; + +fn spawn(mut f: Box<dyn FnMut() + 'static + Send>) { + Builder::new().stack_size(32 * 1024).spawn(move|| f()); +} + +fn child_no(x: usize) -> Box<dyn FnMut() + 'static + Send> { + Box::new(move|| { + if x < generations { + spawn(child_no(x+1)); + } + }) +} + +pub fn main() { + spawn(child_no(0)); +} diff --git a/tests/ui/issues/issue-21909.rs b/tests/ui/issues/issue-21909.rs new file mode 100644 index 000000000..7cb558d9a --- /dev/null +++ b/tests/ui/issues/issue-21909.rs @@ -0,0 +1,15 @@ +// run-pass +// pretty-expanded FIXME #23616 + +trait A<X> { + fn dummy(&self, arg: X); +} + +trait B { + type X; + type Y: A<Self::X>; + + fn dummy(&self); +} + +fn main () { } diff --git a/tests/ui/issues/issue-21922.rs b/tests/ui/issues/issue-21922.rs new file mode 100644 index 000000000..9727b2efe --- /dev/null +++ b/tests/ui/issues/issue-21922.rs @@ -0,0 +1,17 @@ +// run-pass +use std::ops::Add; +fn show(z: i32) { + println!("{}", z) +} +fn main() { + let x = 23; + let y = 42; + show(Add::add( x, y)); + show(Add::add( x, &y)); + show(Add::add(&x, y)); + show(Add::add(&x, &y)); + show( x + y); + show( x + &y); + show(&x + y); + show(&x + &y); +} diff --git a/tests/ui/issues/issue-21946.rs b/tests/ui/issues/issue-21946.rs new file mode 100644 index 000000000..d0c052cb2 --- /dev/null +++ b/tests/ui/issues/issue-21946.rs @@ -0,0 +1,12 @@ +trait Foo { + type A; +} + +struct FooStruct; + +impl Foo for FooStruct { + type A = <FooStruct as Foo>::A; + //~^ ERROR overflow evaluating the requirement `<FooStruct as Foo>::A == _` +} + +fn main() {} diff --git a/tests/ui/issues/issue-21946.stderr b/tests/ui/issues/issue-21946.stderr new file mode 100644 index 000000000..67f6b3081 --- /dev/null +++ b/tests/ui/issues/issue-21946.stderr @@ -0,0 +1,9 @@ +error[E0275]: overflow evaluating the requirement `<FooStruct as Foo>::A == _` + --> $DIR/issue-21946.rs:8:14 + | +LL | type A = <FooStruct as Foo>::A; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/issues/issue-21950.rs b/tests/ui/issues/issue-21950.rs new file mode 100644 index 000000000..72a98bd8d --- /dev/null +++ b/tests/ui/issues/issue-21950.rs @@ -0,0 +1,13 @@ +trait Add<Rhs=Self> { + type Output; +} + +impl Add for i32 { + type Output = i32; +} + +fn main() { + let x = &10 as &dyn Add; + //~^ ERROR E0393 + //~| ERROR E0191 +} diff --git a/tests/ui/issues/issue-21950.stderr b/tests/ui/issues/issue-21950.stderr new file mode 100644 index 000000000..731615a6b --- /dev/null +++ b/tests/ui/issues/issue-21950.stderr @@ -0,0 +1,24 @@ +error[E0191]: the value of the associated type `Output` (from trait `Add`) must be specified + --> $DIR/issue-21950.rs:10:25 + | +LL | type Output; + | ----------- `Output` defined here +... +LL | let x = &10 as &dyn Add; + | ^^^ help: specify the associated type: `Add<Output = Type>` + +error[E0393]: the type parameter `Rhs` must be explicitly specified + --> $DIR/issue-21950.rs:10:25 + | +LL | trait Add<Rhs=Self> { + | ------------------- type parameter `Rhs` must be specified for this +... +LL | let x = &10 as &dyn Add; + | ^^^ help: set the type parameter to the desired type: `Add<Rhs>` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0191, E0393. +For more information about an error, try `rustc --explain E0191`. diff --git a/tests/ui/issues/issue-21974.rs b/tests/ui/issues/issue-21974.rs new file mode 100644 index 000000000..f7c659be1 --- /dev/null +++ b/tests/ui/issues/issue-21974.rs @@ -0,0 +1,18 @@ +// Test that (for now) we report an ambiguity error here, because +// specific trait relationships are ignored for the purposes of trait +// matching. This behavior should likely be improved such that this +// test passes. See #21974 for more details. + +trait Foo { + fn foo(self); +} + +fn foo<'a,'b,T>(x: &'a T, y: &'b T) + where &'a T : Foo, //~ ERROR type annotations needed + &'b T : Foo +{ + x.foo(); + y.foo(); +} + +fn main() { } diff --git a/tests/ui/issues/issue-21974.stderr b/tests/ui/issues/issue-21974.stderr new file mode 100644 index 000000000..2d60b18b1 --- /dev/null +++ b/tests/ui/issues/issue-21974.stderr @@ -0,0 +1,17 @@ +error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo` + --> $DIR/issue-21974.rs:11:19 + | +LL | where &'a T : Foo, + | ^^^ + | +note: multiple `impl`s or `where` clauses satisfying `&'a T: Foo` found + --> $DIR/issue-21974.rs:11:19 + | +LL | where &'a T : Foo, + | ^^^ +LL | &'b T : Foo + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/issues/issue-22008.rs b/tests/ui/issues/issue-22008.rs new file mode 100644 index 000000000..004255822 --- /dev/null +++ b/tests/ui/issues/issue-22008.rs @@ -0,0 +1,9 @@ +// run-pass +pub fn main() { + let command = "a"; + + match command { + "foo" => println!("foo"), + _ => println!("{}", command), + } +} diff --git a/tests/ui/issues/issue-22034.rs b/tests/ui/issues/issue-22034.rs new file mode 100644 index 000000000..405ffd089 --- /dev/null +++ b/tests/ui/issues/issue-22034.rs @@ -0,0 +1,11 @@ +#![feature(rustc_private)] + +extern crate libc; + +fn main() { + let ptr: *mut () = core::ptr::null_mut(); + let _: &mut dyn Fn() = unsafe { + &mut *(ptr as *mut dyn Fn()) + //~^ ERROR expected a `Fn<()>` closure, found `()` + }; +} diff --git a/tests/ui/issues/issue-22034.stderr b/tests/ui/issues/issue-22034.stderr new file mode 100644 index 000000000..b32de5b24 --- /dev/null +++ b/tests/ui/issues/issue-22034.stderr @@ -0,0 +1,13 @@ +error[E0277]: expected a `Fn<()>` closure, found `()` + --> $DIR/issue-22034.rs:8:16 + | +LL | &mut *(ptr as *mut dyn Fn()) + | ^^^ expected an `Fn<()>` closure, found `()` + | + = help: the trait `Fn<()>` is not implemented for `()` + = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` + = note: required for the cast from `()` to the object type `dyn Fn()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-22036.rs b/tests/ui/issues/issue-22036.rs new file mode 100644 index 000000000..30da2130a --- /dev/null +++ b/tests/ui/issues/issue-22036.rs @@ -0,0 +1,25 @@ +// run-pass + +trait DigitCollection: Sized { + type Iter: Iterator<Item = u8>; + fn digit_iter(self) -> Self::Iter; + + fn digit_sum(self) -> u32 { + self.digit_iter() + .map(|digit: u8| digit as u32) + .fold(0, |sum, digit| sum + digit) + } +} + +impl<I> DigitCollection for I where I: Iterator<Item=u8> { + type Iter = I; + + fn digit_iter(self) -> I { + self + } +} + +fn main() { + let xs = vec![1, 2, 3, 4, 5]; + assert_eq!(xs.into_iter().digit_sum(), 15); +} diff --git a/tests/ui/issues/issue-2214.rs b/tests/ui/issues/issue-2214.rs new file mode 100644 index 000000000..1994c3515 --- /dev/null +++ b/tests/ui/issues/issue-2214.rs @@ -0,0 +1,41 @@ +// run-pass +// ignore-wasm32-bare no libc to test ffi with +// ignore-sgx no libc +#![feature(rustc_private)] + +extern crate libc; + +use libc::{c_double, c_int}; +use std::mem; + +fn to_c_int(v: &mut isize) -> &mut c_int { + unsafe { mem::transmute_copy(&v) } +} + +fn lgamma(n: c_double, value: &mut isize) -> c_double { + unsafe { + return m::lgamma(n, to_c_int(value)); + } +} + +mod m { + use libc::{c_double, c_int}; + + extern "C" { + #[cfg(all(unix, not(target_os = "vxworks")))] + #[link_name="lgamma_r"] + pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; + #[cfg(windows)] + #[link_name = "lgamma"] + pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; + #[cfg(target_os = "vxworks")] + #[link_name = "lgamma"] + pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; + } +} + +pub fn main() { + let mut y: isize = 5; + let x: &mut isize = &mut y; + assert_eq!(lgamma(1.0 as c_double, x), 0.0 as c_double); +} diff --git a/tests/ui/issues/issue-22258.rs b/tests/ui/issues/issue-22258.rs new file mode 100644 index 000000000..93ead5818 --- /dev/null +++ b/tests/ui/issues/issue-22258.rs @@ -0,0 +1,10 @@ +// run-pass +use std::ops::Add; + +fn f<T: Add>(a: T, b: T) -> <T as Add>::Output { + a + b +} + +fn main() { + println!("a + b is {}", f::<f32>(100f32, 200f32)); +} diff --git a/tests/ui/issues/issue-22289.rs b/tests/ui/issues/issue-22289.rs new file mode 100644 index 000000000..e1b3dfe5b --- /dev/null +++ b/tests/ui/issues/issue-22289.rs @@ -0,0 +1,3 @@ +fn main() { + 0 as &dyn std::any::Any; //~ ERROR non-primitive cast +} diff --git a/tests/ui/issues/issue-22289.stderr b/tests/ui/issues/issue-22289.stderr new file mode 100644 index 000000000..b594e8b7a --- /dev/null +++ b/tests/ui/issues/issue-22289.stderr @@ -0,0 +1,14 @@ +error[E0605]: non-primitive cast: `i32` as `&(dyn Any + 'static)` + --> $DIR/issue-22289.rs:2:5 + | +LL | 0 as &dyn std::any::Any; + | ^^^^^^^^^^^^^^^^^^^^^^^ invalid cast + | +help: consider borrowing the value + | +LL | &0 as &dyn std::any::Any; + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0605`. diff --git a/tests/ui/issues/issue-22312.rs b/tests/ui/issues/issue-22312.rs new file mode 100644 index 000000000..4e359b341 --- /dev/null +++ b/tests/ui/issues/issue-22312.rs @@ -0,0 +1,17 @@ +use std::ops::Index; + +pub trait Array2D: Index<usize> + Sized { + fn rows(&self) -> usize; + fn columns(&self) -> usize; + fn get<'a>(&'a self, y: usize, x: usize) -> Option<&'a <Self as Index<usize>>::Output> { + if y >= self.rows() || x >= self.columns() { + return None; + } + let i = y * self.columns() + x; + let indexer = &(*self as &dyn Index<usize, Output = <Self as Index<usize>>::Output>); + //~^ERROR non-primitive cast + Some(indexer.index(i)) + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-22312.stderr b/tests/ui/issues/issue-22312.stderr new file mode 100644 index 000000000..da15c092f --- /dev/null +++ b/tests/ui/issues/issue-22312.stderr @@ -0,0 +1,14 @@ +error[E0605]: non-primitive cast: `Self` as `&dyn Index<usize, Output = <Self as Index<usize>>::Output>` + --> $DIR/issue-22312.rs:11:24 + | +LL | let indexer = &(*self as &dyn Index<usize, Output = <Self as Index<usize>>::Output>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast + | +help: consider borrowing the value + | +LL | let indexer = &(&*self as &dyn Index<usize, Output = <Self as Index<usize>>::Output>); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0605`. diff --git a/tests/ui/issues/issue-22346.rs b/tests/ui/issues/issue-22346.rs new file mode 100644 index 000000000..5f6d9dcc9 --- /dev/null +++ b/tests/ui/issues/issue-22346.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +// This used to cause an ICE because the retslot for the "return" had the wrong type +fn testcase<'a>() -> Box<dyn Iterator<Item=usize> + 'a> { + return Box::new((0..3).map(|i| { return i; })); +} + +fn main() { +} diff --git a/tests/ui/issues/issue-22356.rs b/tests/ui/issues/issue-22356.rs new file mode 100644 index 000000000..47fad3bb9 --- /dev/null +++ b/tests/ui/issues/issue-22356.rs @@ -0,0 +1,34 @@ +// check-pass +#![allow(type_alias_bounds)] + +// pretty-expanded FIXME #23616 + +use std::marker::PhantomData; + +pub struct Handle<T, I>(T, I); + +impl<T, I> Handle<T, I> { + pub fn get_info(&self) -> &I { + let Handle(_, ref info) = *self; + info + } +} + +pub struct BufferHandle<D: Device, T> { + raw: RawBufferHandle<D>, + _marker: PhantomData<T>, +} + +impl<D: Device, T> BufferHandle<D, T> { + pub fn get_info(&self) -> &String { + self.raw.get_info() + } +} + +pub type RawBufferHandle<D: Device> = Handle<<D as Device>::Buffer, String>; + +pub trait Device { + type Buffer; +} + +fn main() {} diff --git a/tests/ui/issues/issue-22370.rs b/tests/ui/issues/issue-22370.rs new file mode 100644 index 000000000..bab0469c0 --- /dev/null +++ b/tests/ui/issues/issue-22370.rs @@ -0,0 +1,6 @@ +trait A<T=Self> {} + +fn f(a: &dyn A) {} +//~^ ERROR E0393 + +fn main() {} diff --git a/tests/ui/issues/issue-22370.stderr b/tests/ui/issues/issue-22370.stderr new file mode 100644 index 000000000..cd27c4e4e --- /dev/null +++ b/tests/ui/issues/issue-22370.stderr @@ -0,0 +1,14 @@ +error[E0393]: the type parameter `T` must be explicitly specified + --> $DIR/issue-22370.rs:3:14 + | +LL | trait A<T=Self> {} + | --------------- type parameter `T` must be specified for this +LL | +LL | fn f(a: &dyn A) {} + | ^ help: set the type parameter to the desired type: `A<T>` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0393`. diff --git a/tests/ui/issues/issue-22384.rs b/tests/ui/issues/issue-22384.rs new file mode 100644 index 000000000..98988f27e --- /dev/null +++ b/tests/ui/issues/issue-22384.rs @@ -0,0 +1,8 @@ +trait Trait { + fn foo(); +} + +fn main() { + <<i32 as Copy>::foobar as Trait>::foo(); + //~^ ERROR cannot find associated type `foobar` in trait `Copy` +} diff --git a/tests/ui/issues/issue-22384.stderr b/tests/ui/issues/issue-22384.stderr new file mode 100644 index 000000000..1f767a443 --- /dev/null +++ b/tests/ui/issues/issue-22384.stderr @@ -0,0 +1,9 @@ +error[E0576]: cannot find associated type `foobar` in trait `Copy` + --> $DIR/issue-22384.rs:6:21 + | +LL | <<i32 as Copy>::foobar as Trait>::foo(); + | ^^^^^^ not found in `Copy` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0576`. diff --git a/tests/ui/issues/issue-22403.rs b/tests/ui/issues/issue-22403.rs new file mode 100644 index 000000000..8d8559094 --- /dev/null +++ b/tests/ui/issues/issue-22403.rs @@ -0,0 +1,6 @@ +// run-pass +fn main() { + let x = Box::new([1, 2, 3]); + let y = x as Box<[i32]>; + println!("y: {:?}", y); +} diff --git a/tests/ui/issues/issue-22426.rs b/tests/ui/issues/issue-22426.rs new file mode 100644 index 000000000..adf060a82 --- /dev/null +++ b/tests/ui/issues/issue-22426.rs @@ -0,0 +1,9 @@ +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + match 42 { + x if x < 7 => (), + _ => () + } +} diff --git a/tests/ui/issues/issue-22434.rs b/tests/ui/issues/issue-22434.rs new file mode 100644 index 000000000..34057b46e --- /dev/null +++ b/tests/ui/issues/issue-22434.rs @@ -0,0 +1,8 @@ +pub trait Foo { + type A; +} + +type I<'a> = &'a (dyn Foo + 'a); +//~^ ERROR the value of the associated type `A` (from trait `Foo`) must be specified + +fn main() {} diff --git a/tests/ui/issues/issue-22434.stderr b/tests/ui/issues/issue-22434.stderr new file mode 100644 index 000000000..b97fa2503 --- /dev/null +++ b/tests/ui/issues/issue-22434.stderr @@ -0,0 +1,12 @@ +error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified + --> $DIR/issue-22434.rs:5:23 + | +LL | type A; + | ------ `A` defined here +... +LL | type I<'a> = &'a (dyn Foo + 'a); + | ^^^ help: specify the associated type: `Foo<A = Type>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0191`. diff --git a/tests/ui/issues/issue-22468.rs b/tests/ui/issues/issue-22468.rs new file mode 100644 index 000000000..197a19c03 --- /dev/null +++ b/tests/ui/issues/issue-22468.rs @@ -0,0 +1,9 @@ +fn main() { + let foo = "bar"; + let x = foo("baz"); + //~^ ERROR: expected function, found `&str` +} + +fn foo(file: &str) -> bool { + true +} diff --git a/tests/ui/issues/issue-22468.stderr b/tests/ui/issues/issue-22468.stderr new file mode 100644 index 000000000..3fff91acb --- /dev/null +++ b/tests/ui/issues/issue-22468.stderr @@ -0,0 +1,13 @@ +error[E0618]: expected function, found `&str` + --> $DIR/issue-22468.rs:3:13 + | +LL | let foo = "bar"; + | --- `foo` has type `&str` +LL | let x = foo("baz"); + | ^^^------- + | | + | call expression requires function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-22471.rs b/tests/ui/issues/issue-22471.rs new file mode 100644 index 000000000..69879ab7f --- /dev/null +++ b/tests/ui/issues/issue-22471.rs @@ -0,0 +1,7 @@ +// check-pass +#![allow(dead_code)] +#![allow(type_alias_bounds)] + +type Foo<T> where T: Copy = Box<T>; + +fn main(){} diff --git a/tests/ui/issues/issue-22536-copy-mustnt-zero.rs b/tests/ui/issues/issue-22536-copy-mustnt-zero.rs new file mode 100644 index 000000000..017f36484 --- /dev/null +++ b/tests/ui/issues/issue-22536-copy-mustnt-zero.rs @@ -0,0 +1,28 @@ +// run-pass +// Regression test for Issue #22536: If a type implements Copy, then +// moving it must not zero the original memory. + + +trait Resources { + type Buffer: Copy; + fn foo(&self) {} +} + +struct BufferHandle<R: Resources> { + raw: <R as Resources>::Buffer, +} +impl<R: Resources> Copy for BufferHandle<R> {} +impl<R: Resources> Clone for BufferHandle<R> { + fn clone(&self) -> BufferHandle<R> { *self } +} + +enum Res {} +impl Resources for Res { + type Buffer = u32; +} + +fn main() { + let b: BufferHandle<Res> = BufferHandle { raw: 1 }; + let c = b; + assert_eq!(c.raw, b.raw) +} diff --git a/tests/ui/issues/issue-22577.rs b/tests/ui/issues/issue-22577.rs new file mode 100644 index 000000000..8aca21bf1 --- /dev/null +++ b/tests/ui/issues/issue-22577.rs @@ -0,0 +1,26 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +use std::{fs, net}; + +fn assert_both<T: Send + Sync>() {} +fn assert_send<T: Send>() {} + +fn main() { + assert_both::<fs::File>(); + assert_both::<fs::Metadata>(); + assert_both::<fs::ReadDir>(); + assert_both::<fs::DirEntry>(); + assert_both::<fs::OpenOptions>(); + assert_both::<fs::Permissions>(); + + assert_both::<net::TcpStream>(); + assert_both::<net::TcpListener>(); + assert_both::<net::UdpSocket>(); + assert_both::<net::SocketAddr>(); + assert_both::<net::SocketAddrV4>(); + assert_both::<net::SocketAddrV6>(); + assert_both::<net::Ipv4Addr>(); + assert_both::<net::Ipv6Addr>(); +} diff --git a/tests/ui/issues/issue-22599.rs b/tests/ui/issues/issue-22599.rs new file mode 100644 index 000000000..05096e5c1 --- /dev/null +++ b/tests/ui/issues/issue-22599.rs @@ -0,0 +1,10 @@ +#![deny(unused_variables)] + +fn f(_: i32) {} + +fn main() { + let mut v = 0; + f(v); + v = match 0 { a => 0 }; //~ ERROR: unused variable: `a` + f(v); +} diff --git a/tests/ui/issues/issue-22599.stderr b/tests/ui/issues/issue-22599.stderr new file mode 100644 index 000000000..2b34830d0 --- /dev/null +++ b/tests/ui/issues/issue-22599.stderr @@ -0,0 +1,14 @@ +error: unused variable: `a` + --> $DIR/issue-22599.rs:8:19 + | +LL | v = match 0 { a => 0 }; + | ^ help: if this is intentional, prefix it with an underscore: `_a` + | +note: the lint level is defined here + --> $DIR/issue-22599.rs:1:9 + | +LL | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-22603.rs b/tests/ui/issues/issue-22603.rs new file mode 100644 index 000000000..a83e291f9 --- /dev/null +++ b/tests/ui/issues/issue-22603.rs @@ -0,0 +1,15 @@ +// check-pass + +#![feature(unboxed_closures, fn_traits)] + +struct Foo; + +impl<A> FnOnce<(A,)> for Foo { + type Output = (); + extern "rust-call" fn call_once(self, (_,): (A,)) { + } +} + +fn main() { + println!("{:?}", Foo("bar")); +} diff --git a/tests/ui/issues/issue-22629.rs b/tests/ui/issues/issue-22629.rs new file mode 100644 index 000000000..7beeb126e --- /dev/null +++ b/tests/ui/issues/issue-22629.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(unused_imports)] +// Test transitive analysis for associated types. Collected types +// should be normalized and new obligations generated. + +// pretty-expanded FIXME #23616 + +use std::borrow::{ToOwned, Cow}; + +fn assert_send<T: Send>(_: T) {} + +fn main() { + assert_send(Cow::Borrowed("foo")); +} diff --git a/tests/ui/issues/issue-22638.polonius.stderr b/tests/ui/issues/issue-22638.polonius.stderr new file mode 100644 index 000000000..87a7c00e4 --- /dev/null +++ b/tests/ui/issues/issue-22638.polonius.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `A::matches::$CLOSURE` + --> $DIR/issue-22638.rs:56:9 + | +LL | a.matches(f) + | ^^^^^^^^^^^^ + | +note: `A::matches` defined here + --> $DIR/issue-22638.rs:15:5 + | +LL | pub fn matches<F: Fn()>(&self, f: &F) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-22638.polonius/issue-22638.long-type.txt' + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-22638.rs b/tests/ui/issues/issue-22638.rs new file mode 100644 index 000000000..198ceccc2 --- /dev/null +++ b/tests/ui/issues/issue-22638.rs @@ -0,0 +1,63 @@ +// build-fail +// normalize-stderr-test: "<\[closure@.+`" -> "$$CLOSURE`" +// normalize-stderr-test: ".nll/" -> "/" + +#![allow(unused)] + +#![recursion_limit = "20"] +#![type_length_limit = "20000000"] +#![crate_type = "rlib"] + +#[derive(Clone)] +struct A (B); + +impl A { + pub fn matches<F: Fn()>(&self, f: &F) { + let &A(ref term) = self; + term.matches(f); + } +} + +#[derive(Clone)] +enum B { + Variant1, + Variant2(C), +} + +impl B { + pub fn matches<F: Fn()>(&self, f: &F) { + match self { + &B::Variant2(ref factor) => { + factor.matches(&|| ()) + } + _ => unreachable!("") + } + } +} + +#[derive(Clone)] +struct C (D); + +impl C { + pub fn matches<F: Fn()>(&self, f: &F) { + let &C(ref base) = self; + base.matches(&|| { + C(base.clone()).matches(f) + }) + } +} + +#[derive(Clone)] +struct D (Box<A>); + +impl D { + pub fn matches<F: Fn()>(&self, f: &F) { + let &D(ref a) = self; + a.matches(f) + //~^ ERROR reached the recursion limit while instantiating `A::matches::<[closure + } +} + +pub fn matches() { + A(B::Variant1).matches(&(|| ())) +} diff --git a/tests/ui/issues/issue-22638.stderr b/tests/ui/issues/issue-22638.stderr new file mode 100644 index 000000000..1caa4221f --- /dev/null +++ b/tests/ui/issues/issue-22638.stderr @@ -0,0 +1,14 @@ +error: reached the recursion limit while instantiating `A::matches::$CLOSURE` + --> $DIR/issue-22638.rs:56:9 + | +LL | a.matches(f) + | ^^^^^^^^^^^^ + | +note: `A::matches` defined here + --> $DIR/issue-22638.rs:15:5 + | +LL | pub fn matches<F: Fn()>(&self, f: &F) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-22644.rs b/tests/ui/issues/issue-22644.rs new file mode 100644 index 000000000..b1d69dcd8 --- /dev/null +++ b/tests/ui/issues/issue-22644.rs @@ -0,0 +1,35 @@ +#![feature(type_ascription)] + +fn main() { + let a : usize = 0; + let long_name : usize = 0; + + println!("{}", a as usize > long_name); + println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic + println!("{}{}", a as usize < long_name, long_name); + //~^ ERROR `<` is interpreted as a start of generic + println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic + println!("{}", a: usize > long_name); + println!("{}{}", a: usize < long_name, long_name); + //~^ ERROR `<` is interpreted as a start of generic + println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic + + println!("{}", a + as + usize + < //~ ERROR `<` is interpreted as a start of generic + 4); + println!("{}", a + + + as + + + usize + < //~ ERROR `<` is interpreted as a start of generic + 5); + + println!("{}", a as usize << long_name); //~ ERROR `<<` is interpreted as a start of generic + + println!("{}", a: &mut 4); //~ ERROR expected type, found `4` +} diff --git a/tests/ui/issues/issue-22644.stderr b/tests/ui/issues/issue-22644.stderr new file mode 100644 index 000000000..45027afa7 --- /dev/null +++ b/tests/ui/issues/issue-22644.stderr @@ -0,0 +1,123 @@ +error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison + --> $DIR/issue-22644.rs:8:31 + | +LL | println!("{}", a as usize < long_name); + | ^ --------- interpreted as generic arguments + | | + | not interpreted as comparison + | +help: try comparing the cast value + | +LL | println!("{}", (a as usize) < long_name); + | + + + +error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison + --> $DIR/issue-22644.rs:9:33 + | +LL | println!("{}{}", a as usize < long_name, long_name); + | ^ -------------------- interpreted as generic arguments + | | + | not interpreted as comparison + | +help: try comparing the cast value + | +LL | println!("{}{}", (a as usize) < long_name, long_name); + | + + + +error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison + --> $DIR/issue-22644.rs:11:31 + | +LL | println!("{}", a as usize < 4); + | ^ - interpreted as generic arguments + | | + | not interpreted as comparison + | +help: try comparing the cast value + | +LL | println!("{}", (a as usize) < 4); + | + + + +error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison + --> $DIR/issue-22644.rs:13:31 + | +LL | println!("{}{}", a: usize < long_name, long_name); + | ^ -------------------- interpreted as generic arguments + | | + | not interpreted as comparison + | +help: try comparing the cast value + | +LL | println!("{}{}", (a: usize) < long_name, long_name); + | + + + +error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison + --> $DIR/issue-22644.rs:15:29 + | +LL | println!("{}", a: usize < 4); + | ^ - interpreted as generic arguments + | | + | not interpreted as comparison + | +help: try comparing the cast value + | +LL | println!("{}", (a: usize) < 4); + | + + + +error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison + --> $DIR/issue-22644.rs:20:20 + | +LL | < + | ^ not interpreted as comparison +LL | 4); + | - interpreted as generic arguments + | +help: try comparing the cast value + | +LL ~ println!("{}", (a +LL | as +LL ~ usize) + | + +error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison + --> $DIR/issue-22644.rs:29:20 + | +LL | < + | ^ not interpreted as comparison +LL | 5); + | - interpreted as generic arguments + | +help: try comparing the cast value + | +LL ~ println!("{}", (a +LL | + ... +LL | +LL ~ usize) + | + +error: `<<` is interpreted as a start of generic arguments for `usize`, not a shift + --> $DIR/issue-22644.rs:32:31 + | +LL | println!("{}", a as usize << long_name); + | ^^ --------- interpreted as generic arguments + | | + | not interpreted as shift + | +help: try shifting the cast value + | +LL | println!("{}", (a as usize) << long_name); + | + + + +error: expected type, found `4` + --> $DIR/issue-22644.rs:34:28 + | +LL | println!("{}", a: &mut 4); + | - ^ expected type + | | + | tried to parse a type due to this type ascription + | + = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>` + = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information + +error: aborting due to 9 previous errors + diff --git a/tests/ui/issues/issue-22673.rs b/tests/ui/issues/issue-22673.rs new file mode 100644 index 000000000..4b9b4d6b2 --- /dev/null +++ b/tests/ui/issues/issue-22673.rs @@ -0,0 +1,7 @@ +// check-pass + +trait Expr: PartialEq<Self::Item> { + type Item; +} + +fn main() {} diff --git a/tests/ui/issues/issue-22684.rs b/tests/ui/issues/issue-22684.rs new file mode 100644 index 000000000..a5b042706 --- /dev/null +++ b/tests/ui/issues/issue-22684.rs @@ -0,0 +1,18 @@ +mod foo { + pub struct Foo; + impl Foo { + fn bar(&self) {} + } + + pub trait Baz { + fn bar(&self) -> bool { true } + } + impl Baz for Foo {} +} + +fn main() { + use foo::Baz; + + // Check that `bar` resolves to the trait method, not the inherent impl method. + let _: () = foo::Foo.bar(); //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-22684.stderr b/tests/ui/issues/issue-22684.stderr new file mode 100644 index 000000000..2407ece5e --- /dev/null +++ b/tests/ui/issues/issue-22684.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/issue-22684.rs:17:17 + | +LL | let _: () = foo::Foo.bar(); + | -- ^^^^^^^^^^^^^^ expected `()`, found `bool` + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-22706.rs b/tests/ui/issues/issue-22706.rs new file mode 100644 index 000000000..bb8a58d3d --- /dev/null +++ b/tests/ui/issues/issue-22706.rs @@ -0,0 +1,3 @@ +fn is_copy<T: ::std::marker<i32>::Copy>() {} +//~^ ERROR type arguments are not allowed on module `marker` [E0109] +fn main() {} diff --git a/tests/ui/issues/issue-22706.stderr b/tests/ui/issues/issue-22706.stderr new file mode 100644 index 000000000..5366a36b1 --- /dev/null +++ b/tests/ui/issues/issue-22706.stderr @@ -0,0 +1,11 @@ +error[E0109]: type arguments are not allowed on module `marker` + --> $DIR/issue-22706.rs:1:29 + | +LL | fn is_copy<T: ::std::marker<i32>::Copy>() {} + | ------ ^^^ type argument not allowed + | | + | not allowed on module `marker` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/issues/issue-22777.rs b/tests/ui/issues/issue-22777.rs new file mode 100644 index 000000000..486683d12 --- /dev/null +++ b/tests/ui/issues/issue-22777.rs @@ -0,0 +1,48 @@ +// check-pass +// This test is reduced from librustc_ast. It is just checking that we +// can successfully deal with a "deep" structure, which the drop-check +// was hitting a recursion limit on at one point. + +// pretty-expanded FIXME #23616 + +#![allow(non_camel_case_types)] + +pub fn noop_fold_impl_item() -> SmallVector<ImplItem> { + loop { } +} + +pub struct SmallVector<T>(P<T>); +pub struct ImplItem(P<S01_Method>); + +struct P<T>(Box<T>); + +struct S01_Method(P<S02_Generics>); +struct S02_Generics(P<S03_TyParam>); +struct S03_TyParam(P<S04_TyParamBound>); +struct S04_TyParamBound(S05_PolyTraitRef); +struct S05_PolyTraitRef(S06_TraitRef); +struct S06_TraitRef(S07_Path); +struct S07_Path(Vec<S08_PathSegment>); +struct S08_PathSegment(S09_GenericArgs); +struct S09_GenericArgs(P<S10_ParenthesizedParameterData>); +struct S10_ParenthesizedParameterData(Option<P<S11_Ty>>); +struct S11_Ty(P<S12_Expr>); +struct S12_Expr(P<S13_Block>); +struct S13_Block(Vec<P<S14_Stmt>>); +struct S14_Stmt(P<S15_Decl>); +struct S15_Decl(P<S16_Local>); +struct S16_Local(P<S17_Pat>); +struct S17_Pat(P<S18_Mac>); +struct S18_Mac(Vec<P<S19_TokenTree>>); +struct S19_TokenTree(P<S20_Token>); +struct S20_Token(P<S21_Nonterminal>); +struct S21_Nonterminal(P<S22_Item>); +struct S22_Item(P<S23_EnumDef>); +struct S23_EnumDef(Vec<P<S24_Variant>>); +struct S24_Variant(P<S25_VariantKind>); +struct S25_VariantKind(P<S26_StructDef>); +struct S26_StructDef(Vec<P<S27_StructField>>); +struct S27_StructField(P<S28_StructFieldKind>); +struct S28_StructFieldKind; + +pub fn main() {} diff --git a/tests/ui/issues/issue-22781.rs b/tests/ui/issues/issue-22781.rs new file mode 100644 index 000000000..d644cec4d --- /dev/null +++ b/tests/ui/issues/issue-22781.rs @@ -0,0 +1,15 @@ +// check-pass +#![allow(unused_variables)] +use std::collections::HashMap; +use std::collections::hash_map::Entry::Vacant; + +pub fn foo() { + type F = Box<dyn Fn(&()) + 'static>; + let mut map: HashMap<(), F> = HashMap::new(); + let x: &mut F = match map.entry(()) { + Vacant(_) => unimplemented!(), + _ => unimplemented!() + }; +} + +fn main() {} diff --git a/tests/ui/issues/issue-22789.rs b/tests/ui/issues/issue-22789.rs new file mode 100644 index 000000000..cef407537 --- /dev/null +++ b/tests/ui/issues/issue-22789.rs @@ -0,0 +1,8 @@ +// check-pass + +#![feature(unboxed_closures, fn_traits)] + +fn main() { + let k = |x: i32| { x + 1 }; + Fn::call(&k, (0,)); +} diff --git a/tests/ui/issues/issue-2281-part1.rs b/tests/ui/issues/issue-2281-part1.rs new file mode 100644 index 000000000..8340ade22 --- /dev/null +++ b/tests/ui/issues/issue-2281-part1.rs @@ -0,0 +1 @@ +fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope diff --git a/tests/ui/issues/issue-2281-part1.stderr b/tests/ui/issues/issue-2281-part1.stderr new file mode 100644 index 000000000..c2391a7c0 --- /dev/null +++ b/tests/ui/issues/issue-2281-part1.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `foobar` in this scope + --> $DIR/issue-2281-part1.rs:1:28 + | +LL | fn main() { println!("{}", foobar); } + | ^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/issues/issue-22814.rs b/tests/ui/issues/issue-22814.rs new file mode 100644 index 000000000..4079adfc8 --- /dev/null +++ b/tests/ui/issues/issue-22814.rs @@ -0,0 +1,13 @@ +// check-pass +trait Test {} + +macro_rules! test { +( $($name:ident)+) => ( + impl<$($name: Test),+> Test for ($($name,)+) { + } +) +} + +test!(A B C); + +fn main() {} diff --git a/tests/ui/issues/issue-2284.rs b/tests/ui/issues/issue-2284.rs new file mode 100644 index 000000000..6f2c95834 --- /dev/null +++ b/tests/ui/issues/issue-2284.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait Send { + fn f(&self); +} + +fn f<T:Send>(t: T) { + t.f(); +} + +pub fn main() { +} diff --git a/tests/ui/issues/issue-22864-1.rs b/tests/ui/issues/issue-22864-1.rs new file mode 100644 index 000000000..0fad5433d --- /dev/null +++ b/tests/ui/issues/issue-22864-1.rs @@ -0,0 +1,7 @@ +// run-pass +pub fn main() { + struct Fun<F>(F); + let f = Fun(|x| 3*x); + let Fun(g) = f; + println!("{:?}",g(4)); +} diff --git a/tests/ui/issues/issue-22864-2.rs b/tests/ui/issues/issue-22864-2.rs new file mode 100644 index 000000000..4aa9e3e08 --- /dev/null +++ b/tests/ui/issues/issue-22864-2.rs @@ -0,0 +1,7 @@ +// run-pass +// ignore-emscripten no threads support + +pub fn main() { + let f = || || 0; + std::thread::spawn(f()); +} diff --git a/tests/ui/issues/issue-22872.rs b/tests/ui/issues/issue-22872.rs new file mode 100644 index 000000000..5db2891e6 --- /dev/null +++ b/tests/ui/issues/issue-22872.rs @@ -0,0 +1,24 @@ +trait Wrap<'b> { + fn foo(&'b mut self); +} + +struct Wrapper<P>(P); + +impl<'b, P> Wrap<'b> for Wrapper<P> +where P: Process<'b>, + <P as Process<'b>>::Item: Iterator { + fn foo(&mut self) {} +} + + +pub trait Process<'a> { + type Item; + fn bar(&'a self); +} + +fn push_process<P>(process: P) where P: Process<'static> { + let _: Box<dyn for<'b> Wrap<'b>> = Box::new(Wrapper(process)); +//~^ ERROR is not an iterator +} + +fn main() {} diff --git a/tests/ui/issues/issue-22872.stderr b/tests/ui/issues/issue-22872.stderr new file mode 100644 index 000000000..951019719 --- /dev/null +++ b/tests/ui/issues/issue-22872.stderr @@ -0,0 +1,24 @@ +error[E0277]: `<P as Process<'_>>::Item` is not an iterator + --> $DIR/issue-22872.rs:20:40 + | +LL | let _: Box<dyn for<'b> Wrap<'b>> = Box::new(Wrapper(process)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `<P as Process<'_>>::Item` is not an iterator + | + = help: the trait `Iterator` is not implemented for `<P as Process<'_>>::Item` +note: required for `Wrapper<P>` to implement `for<'b> Wrap<'b>` + --> $DIR/issue-22872.rs:7:13 + | +LL | impl<'b, P> Wrap<'b> for Wrapper<P> + | ^^^^^^^^ ^^^^^^^^^^ +LL | where P: Process<'b>, +LL | <P as Process<'b>>::Item: Iterator { + | -------- unsatisfied trait bound introduced here + = note: required for the cast from `Wrapper<P>` to the object type `dyn for<'b> Wrap<'b>` +help: consider further restricting the associated type + | +LL | fn push_process<P>(process: P) where P: Process<'static>, <P as Process<'_>>::Item: Iterator { + | ++++++++++++++++++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-22874.rs b/tests/ui/issues/issue-22874.rs new file mode 100644 index 000000000..37c6c8143 --- /dev/null +++ b/tests/ui/issues/issue-22874.rs @@ -0,0 +1,10 @@ +struct Table { + rows: [[String]], + //~^ ERROR the size for values of type +} + +fn f(table: &Table) -> &[String] { + &table.rows[0] +} + +fn main() {} diff --git a/tests/ui/issues/issue-22874.stderr b/tests/ui/issues/issue-22874.stderr new file mode 100644 index 000000000..d64899080 --- /dev/null +++ b/tests/ui/issues/issue-22874.stderr @@ -0,0 +1,12 @@ +error[E0277]: the size for values of type `[String]` cannot be known at compilation time + --> $DIR/issue-22874.rs:2:11 + | +LL | rows: [[String]], + | ^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[String]` + = note: slice and array elements must have `Sized` type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-2288.rs b/tests/ui/issues/issue-2288.rs new file mode 100644 index 000000000..6fd690a4d --- /dev/null +++ b/tests/ui/issues/issue-2288.rs @@ -0,0 +1,33 @@ +// run-pass +#![allow(non_camel_case_types)] + +trait clam<A> { + fn chowder(&self, y: A); +} + +#[derive(Copy, Clone)] +struct foo<A> { + x: A, +} + +impl<A> clam<A> for foo<A> { + fn chowder(&self, _y: A) { + } +} + +fn foo<A>(b: A) -> foo<A> { + foo { + x: b + } +} + +fn f<A>(x: Box<dyn clam<A>>, a: A) { + x.chowder(a); +} + +pub fn main() { + + let c = foo(42); + let d: Box<dyn clam<isize>> = Box::new(c) as Box<dyn clam<isize>>; + f(d, c.x); +} diff --git a/tests/ui/issues/issue-22886.rs b/tests/ui/issues/issue-22886.rs new file mode 100644 index 000000000..f8b576e09 --- /dev/null +++ b/tests/ui/issues/issue-22886.rs @@ -0,0 +1,21 @@ +// Regression test for #22886. + +fn crash_please() { + let mut iter = Newtype(Some(Box::new(0))); + let saved = iter.next().unwrap(); + println!("{}", saved); + iter.0 = None; + println!("{}", saved); +} + +struct Newtype(Option<Box<usize>>); + +impl<'a> Iterator for Newtype { //~ ERROR E0207 + type Item = &'a Box<usize>; + + fn next(&mut self) -> Option<&Box<usize>> { + self.0.as_ref() + } +} + +fn main() { } diff --git a/tests/ui/issues/issue-22886.stderr b/tests/ui/issues/issue-22886.stderr new file mode 100644 index 000000000..c4b396559 --- /dev/null +++ b/tests/ui/issues/issue-22886.stderr @@ -0,0 +1,9 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-22886.rs:13:6 + | +LL | impl<'a> Iterator for Newtype { + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/issues/issue-22894.rs b/tests/ui/issues/issue-22894.rs new file mode 100644 index 000000000..93c1db914 --- /dev/null +++ b/tests/ui/issues/issue-22894.rs @@ -0,0 +1,4 @@ +// build-pass +#[allow(dead_code)] +static X: &'static str = &*""; +fn main() {} diff --git a/tests/ui/issues/issue-22933-1.rs b/tests/ui/issues/issue-22933-1.rs new file mode 100644 index 000000000..3c9aa2669 --- /dev/null +++ b/tests/ui/issues/issue-22933-1.rs @@ -0,0 +1,23 @@ +// check-pass + +struct CNFParser { + token: char, +} + +impl CNFParser { + fn is_whitespace(c: char) -> bool { + c == ' ' || c == '\n' + } + + fn consume_whitespace(&mut self) { + self.consume_while(&(CNFParser::is_whitespace)) + } + + fn consume_while(&mut self, p: &dyn Fn(char) -> bool) { + while p(self.token) { + return + } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-22933-2.rs b/tests/ui/issues/issue-22933-2.rs new file mode 100644 index 000000000..dfd84b9a7 --- /dev/null +++ b/tests/ui/issues/issue-22933-2.rs @@ -0,0 +1,8 @@ +enum Delicious { + Pie = 0x1, + Apple = 0x2, + ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, + //~^ ERROR no variant or associated item named `PIE` found +} + +fn main() {} diff --git a/tests/ui/issues/issue-22933-2.stderr b/tests/ui/issues/issue-22933-2.stderr new file mode 100644 index 000000000..1a0e87e15 --- /dev/null +++ b/tests/ui/issues/issue-22933-2.stderr @@ -0,0 +1,15 @@ +error[E0599]: no variant or associated item named `PIE` found for enum `Delicious` in the current scope + --> $DIR/issue-22933-2.rs:4:55 + | +LL | enum Delicious { + | -------------- variant or associated item `PIE` not found for this enum +... +LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, + | ^^^ + | | + | variant or associated item not found in `Delicious` + | help: there is a variant with a similar name: `Pie` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-22992-2.rs b/tests/ui/issues/issue-22992-2.rs new file mode 100644 index 000000000..042af40ed --- /dev/null +++ b/tests/ui/issues/issue-22992-2.rs @@ -0,0 +1,18 @@ +// run-pass +struct A(B); +struct B; + +use std::ops::Deref; + +impl Deref for A { + type Target = B; + fn deref(&self) -> &B { &self.0 } +} + +impl B { + fn foo(&self) {} +} + +fn main() { + A(B).foo(); +} diff --git a/tests/ui/issues/issue-22992.rs b/tests/ui/issues/issue-22992.rs new file mode 100644 index 000000000..292a0ae29 --- /dev/null +++ b/tests/ui/issues/issue-22992.rs @@ -0,0 +1,75 @@ +// run-pass + +struct X { val: i32 } +impl std::ops::Deref for X { + type Target = i32; + fn deref(&self) -> &i32 { &self.val } +} + + +trait M { fn m(self); } +impl M for i32 { fn m(self) { println!("i32::m()"); } } +impl M for X { fn m(self) { println!("X::m()"); } } +impl<'a> M for &'a X { fn m(self) { println!("&X::m()"); } } +impl<'a, 'b> M for &'a &'b X { fn m(self) { println!("&&X::m()"); } } +impl<'a, 'b, 'c> M for &'a &'b &'c X { fn m(self) { println!("&&&X::m()"); } } + +trait RefM { fn refm(&self); } +impl RefM for i32 { fn refm(&self) { println!("i32::refm()"); } } +impl RefM for X { fn refm(&self) { println!("X::refm()"); } } +impl<'a> RefM for &'a X { fn refm(&self) { println!("&X::refm()"); } } +impl<'a, 'b> RefM for &'a &'b X { fn refm(&self) { println!("&&X::refm()"); } } +impl<'a, 'b, 'c> RefM for &'a &'b &'c X { fn refm(&self) { println!("&&&X::refm()"); } } + +struct Y { val: i32 } +impl std::ops::Deref for Y { + type Target = i32; + fn deref(&self) -> &i32 { &self.val } +} + +struct Z { val: Y } +impl std::ops::Deref for Z { + type Target = Y; + fn deref(&self) -> &Y { &self.val } +} + +struct A; +impl std::marker::Copy for A {} +impl Clone for A { fn clone(&self) -> Self { *self } } +impl M for A { fn m(self) { println!("A::m()"); } } +impl<'a, 'b, 'c> M for &'a &'b &'c A { fn m(self) { println!("&&&A::m()"); } } +impl RefM for A { fn refm(&self) { println!("A::refm()"); } } +impl<'a, 'b, 'c> RefM for &'a &'b &'c A { fn refm(&self) { println!("&&&A::refm()"); } } + +fn main() { + // I'll use @ to denote left side of the dot operator + (*X{val:42}).m(); // i32::refm() , self == @ + X{val:42}.m(); // X::m() , self == @ + (&X{val:42}).m(); // &X::m() , self == @ + (&&X{val:42}).m(); // &&X::m() , self == @ + (&&&X{val:42}).m(); // &&&X:m() , self == @ + (&&&&X{val:42}).m(); // &&&X::m() , self == *@ + (&&&&&X{val:42}).m(); // &&&X::m() , self == **@ + + (*X{val:42}).refm(); // i32::refm() , self == @ + X{val:42}.refm(); // X::refm() , self == @ + (&X{val:42}).refm(); // X::refm() , self == *@ + (&&X{val:42}).refm(); // &X::refm() , self == *@ + (&&&X{val:42}).refm(); // &&X::refm() , self == *@ + (&&&&X{val:42}).refm(); // &&&X::refm(), self == *@ + (&&&&&X{val:42}).refm(); // &&&X::refm(), self == **@ + + Y{val:42}.refm(); // i32::refm() , self == *@ + Z{val:Y{val:42}}.refm(); // i32::refm() , self == **@ + + A.m(); // A::m() , self == @ + // without the Copy trait, (&A).m() would be a compilation error: + // cannot move out of borrowed content + (&A).m(); // A::m() , self == *@ + (&&A).m(); // &&&A::m() , self == &@ + (&&&A).m(); // &&&A::m() , self == @ + A.refm(); // A::refm() , self == @ + (&A).refm(); // A::refm() , self == *@ + (&&A).refm(); // A::refm() , self == **@ + (&&&A).refm(); // &&&A::refm(), self == @ +} diff --git a/tests/ui/issues/issue-23024.rs b/tests/ui/issues/issue-23024.rs new file mode 100644 index 000000000..010281ee3 --- /dev/null +++ b/tests/ui/issues/issue-23024.rs @@ -0,0 +1,12 @@ +use std::any::Any; + +fn main() +{ + fn h(x:i32) -> i32 {3*x} + let mut vfnfer:Vec<Box<dyn Any>> = vec![]; + vfnfer.push(Box::new(h)); + println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + //~^ ERROR the precise format of `Fn`-family traits' + //~| ERROR missing generics for trait `Fn` + //~| ERROR the value of the associated type `Output` (from trait `FnOnce`) +} diff --git a/tests/ui/issues/issue-23024.stderr b/tests/ui/issues/issue-23024.stderr new file mode 100644 index 000000000..2c325ffcc --- /dev/null +++ b/tests/ui/issues/issue-23024.stderr @@ -0,0 +1,30 @@ +error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change + --> $DIR/issue-23024.rs:8:39 + | +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^ help: use parenthetical notation instead: `Fn() -> ()` + | + = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information + = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable + +error[E0107]: missing generics for trait `Fn` + --> $DIR/issue-23024.rs:8:39 + | +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^ expected 1 generic argument + | +help: add missing generic argument + | +LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3)); + | ++++++ + +error[E0191]: the value of the associated type `Output` (from trait `FnOnce`) must be specified + --> $DIR/issue-23024.rs:8:39 + | +LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); + | ^^ help: specify the associated type: `Fn<Output = Type>` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0107, E0191, E0658. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-23036.rs b/tests/ui/issues/issue-23036.rs new file mode 100644 index 000000000..d67f18472 --- /dev/null +++ b/tests/ui/issues/issue-23036.rs @@ -0,0 +1,10 @@ +// run-pass + +use std::collections::HashMap; +use std::path::Path; + +fn main() { + let mut map = HashMap::new(); + map.insert(Path::new("a"), 0); + map.get(Path::new("a")); +} diff --git a/tests/ui/issues/issue-23041.rs b/tests/ui/issues/issue-23041.rs new file mode 100644 index 000000000..a1371521a --- /dev/null +++ b/tests/ui/issues/issue-23041.rs @@ -0,0 +1,7 @@ +use std::any::Any; +fn main() +{ + fn bar(x:i32) ->i32 { 3*x }; + let b:Box<dyn Any> = Box::new(bar as fn(_)->_); + b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282 +} diff --git a/tests/ui/issues/issue-23041.stderr b/tests/ui/issues/issue-23041.stderr new file mode 100644 index 000000000..6592b76a3 --- /dev/null +++ b/tests/ui/issues/issue-23041.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-23041.rs:6:7 + | +LL | b.downcast_ref::<fn(_)->_>(); + | ^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `downcast_ref` + | +help: consider specifying the generic argument + | +LL | b.downcast_ref::<fn(_) -> _>(); + | ~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-23046.rs b/tests/ui/issues/issue-23046.rs new file mode 100644 index 000000000..a68369616 --- /dev/null +++ b/tests/ui/issues/issue-23046.rs @@ -0,0 +1,20 @@ +pub enum Expr<'var, VAR> { + Let(Box<Expr<'var, VAR>>, + Box<dyn for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>) +} + +pub fn add<'var, VAR> + (a: Expr<'var, VAR>, b: Expr<'var, VAR>) -> Expr<'var, VAR> { + loop {} +} + +pub fn let_<'var, VAR, F: for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>> + (a: Expr<'var, VAR>, b: F) -> Expr<'var, VAR> { + loop {} +} + +fn main() { + let ex = |x| { //~ ERROR type annotations needed + let_(add(x,x), |y| { + let_(add(x, x), |x|x)})}; +} diff --git a/tests/ui/issues/issue-23046.stderr b/tests/ui/issues/issue-23046.stderr new file mode 100644 index 000000000..1403ecbd9 --- /dev/null +++ b/tests/ui/issues/issue-23046.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `Expr<'_, VAR>` + --> $DIR/issue-23046.rs:17:15 + | +LL | let ex = |x| { + | ^ + | +help: consider giving this closure parameter an explicit type, where the type for type parameter `VAR` is specified + | +LL | let ex = |x: Expr<'_, VAR>| { + | +++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-23073.rs b/tests/ui/issues/issue-23073.rs new file mode 100644 index 000000000..a0ca91336 --- /dev/null +++ b/tests/ui/issues/issue-23073.rs @@ -0,0 +1,9 @@ +#![feature(associated_type_defaults)] + +trait Foo { type T; } +trait Bar { + type Foo: Foo; + type FooT = <<Self as Bar>::Foo>::T; //~ ERROR ambiguous associated type +} + +fn main() {} diff --git a/tests/ui/issues/issue-23073.stderr b/tests/ui/issues/issue-23073.stderr new file mode 100644 index 000000000..3a9f49ef1 --- /dev/null +++ b/tests/ui/issues/issue-23073.stderr @@ -0,0 +1,14 @@ +error[E0223]: ambiguous associated type + --> $DIR/issue-23073.rs:6:17 + | +LL | type FooT = <<Self as Bar>::Foo>::T; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: if there were a trait named `Example` with associated type `T` implemented for `<Self as Bar>::Foo`, you could use the fully-qualified path + | +LL | type FooT = <<Self as Bar>::Foo as Example>::T; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/issues/issue-2311-2.rs b/tests/ui/issues/issue-2311-2.rs new file mode 100644 index 000000000..760d4edaa --- /dev/null +++ b/tests/ui/issues/issue-2311-2.rs @@ -0,0 +1,26 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + + +trait clam<A> { + fn get(self) -> A; +} + +struct foo<A> { + x: A, +} + +impl<A> foo<A> { + pub fn bar<B,C:clam<A>>(&self, _c: C) -> B { + panic!(); + } +} + +fn foo<A>(b: A) -> foo<A> { + foo { + x: b + } +} + +pub fn main() { } diff --git a/tests/ui/issues/issue-2311.rs b/tests/ui/issues/issue-2311.rs new file mode 100644 index 000000000..21ff19f7f --- /dev/null +++ b/tests/ui/issues/issue-2311.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +trait clam<A> { fn get(self) -> A; } +trait foo<A> { + fn bar<B,C:clam<A>>(&self, c: C) -> B; +} + +pub fn main() { } diff --git a/tests/ui/issues/issue-2312.rs b/tests/ui/issues/issue-2312.rs new file mode 100644 index 000000000..8a94bcbd4 --- /dev/null +++ b/tests/ui/issues/issue-2312.rs @@ -0,0 +1,16 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// Testing that the B's are resolved + + +trait clam<A> { fn get(self) -> A; } + +struct foo(isize); + +impl foo { + pub fn bar<B,C:clam<B>>(&self, _c: C) -> B { panic!(); } +} + +pub fn main() { } diff --git a/tests/ui/issues/issue-23122-1.rs b/tests/ui/issues/issue-23122-1.rs new file mode 100644 index 000000000..7fe0900ed --- /dev/null +++ b/tests/ui/issues/issue-23122-1.rs @@ -0,0 +1,14 @@ +trait Next { + type Next: Next; +} + +struct GetNext<T: Next> { + t: T, +} + +impl<T: Next> Next for GetNext<T> { + type Next = <GetNext<T> as Next>::Next; + //~^ ERROR overflow evaluating the requirement +} + +fn main() {} diff --git a/tests/ui/issues/issue-23122-1.stderr b/tests/ui/issues/issue-23122-1.stderr new file mode 100644 index 000000000..0b568b30e --- /dev/null +++ b/tests/ui/issues/issue-23122-1.stderr @@ -0,0 +1,9 @@ +error[E0275]: overflow evaluating the requirement `<GetNext<T> as Next>::Next == _` + --> $DIR/issue-23122-1.rs:10:17 + | +LL | type Next = <GetNext<T> as Next>::Next; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/issues/issue-23122-2.rs b/tests/ui/issues/issue-23122-2.rs new file mode 100644 index 000000000..338789c2e --- /dev/null +++ b/tests/ui/issues/issue-23122-2.rs @@ -0,0 +1,15 @@ +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" +trait Next { + type Next: Next; +} + +struct GetNext<T: Next> { + t: T, +} + +impl<T: Next> Next for GetNext<T> { + type Next = <GetNext<T::Next> as Next>::Next; + //~^ ERROR overflow evaluating the requirement +} + +fn main() {} diff --git a/tests/ui/issues/issue-23122-2.stderr b/tests/ui/issues/issue-23122-2.stderr new file mode 100644 index 000000000..06e5b711a --- /dev/null +++ b/tests/ui/issues/issue-23122-2.stderr @@ -0,0 +1,19 @@ +error[E0275]: overflow evaluating the requirement `<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized` + --> $DIR/issue-23122-2.rs:11:17 + | +LL | type Next = <GetNext<T::Next> as Next>::Next; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) +note: required for `GetNext<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` + --> $DIR/issue-23122-2.rs:10:15 + | +LL | impl<T: Next> Next for GetNext<T> { + | - ^^^^ ^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-23122-2/issue-23122-2.long-type-hash.txt' + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/issues/issue-2316-c.rs b/tests/ui/issues/issue-2316-c.rs new file mode 100644 index 000000000..d975aa695 --- /dev/null +++ b/tests/ui/issues/issue-2316-c.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:issue-2316-a.rs +// aux-build:issue-2316-b.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_2316_b; +use issue_2316_b::cloth; + +pub fn main() { + let _c: cloth::fabric = cloth::fabric::calico; +} diff --git a/tests/ui/issues/issue-23173.rs b/tests/ui/issues/issue-23173.rs new file mode 100644 index 000000000..92f4c5464 --- /dev/null +++ b/tests/ui/issues/issue-23173.rs @@ -0,0 +1,13 @@ +enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } +struct Struct { + a: usize, +} + +fn use_token(token: &Token) { unimplemented!() } + +fn main() { + use_token(&Token::Homura); //~ ERROR no variant or associated item named `Homura` + Struct::method(); //~ ERROR no function or associated item named `method` found + Struct::method; //~ ERROR no function or associated item named `method` found + Struct::Assoc; //~ ERROR no associated item named `Assoc` found +} diff --git a/tests/ui/issues/issue-23173.stderr b/tests/ui/issues/issue-23173.stderr new file mode 100644 index 000000000..d07d1a7ca --- /dev/null +++ b/tests/ui/issues/issue-23173.stderr @@ -0,0 +1,39 @@ +error[E0599]: no variant or associated item named `Homura` found for enum `Token` in the current scope + --> $DIR/issue-23173.rs:9:23 + | +LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } + | ---------- variant or associated item `Homura` not found for this enum +... +LL | use_token(&Token::Homura); + | ^^^^^^ variant or associated item not found in `Token` + +error[E0599]: no function or associated item named `method` found for struct `Struct` in the current scope + --> $DIR/issue-23173.rs:10:13 + | +LL | struct Struct { + | ------------- function or associated item `method` not found for this struct +... +LL | Struct::method(); + | ^^^^^^ function or associated item not found in `Struct` + +error[E0599]: no function or associated item named `method` found for struct `Struct` in the current scope + --> $DIR/issue-23173.rs:11:13 + | +LL | struct Struct { + | ------------- function or associated item `method` not found for this struct +... +LL | Struct::method; + | ^^^^^^ function or associated item not found in `Struct` + +error[E0599]: no associated item named `Assoc` found for struct `Struct` in the current scope + --> $DIR/issue-23173.rs:12:13 + | +LL | struct Struct { + | ------------- associated item `Assoc` not found for this struct +... +LL | Struct::Assoc; + | ^^^^^ associated item not found in `Struct` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-23189.rs b/tests/ui/issues/issue-23189.rs new file mode 100644 index 000000000..e5526357c --- /dev/null +++ b/tests/ui/issues/issue-23189.rs @@ -0,0 +1,5 @@ +mod module {} + +fn main() { + let _ = module { x: 0 }; //~ERROR expected struct +} diff --git a/tests/ui/issues/issue-23189.stderr b/tests/ui/issues/issue-23189.stderr new file mode 100644 index 000000000..ed065212c --- /dev/null +++ b/tests/ui/issues/issue-23189.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found module `module` + --> $DIR/issue-23189.rs:4:13 + | +LL | let _ = module { x: 0 }; + | ^^^^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/tests/ui/issues/issue-23217.rs b/tests/ui/issues/issue-23217.rs new file mode 100644 index 000000000..09f9ebccf --- /dev/null +++ b/tests/ui/issues/issue-23217.rs @@ -0,0 +1,5 @@ +pub enum SomeEnum { + B = SomeEnum::A, //~ ERROR no variant or associated item named `A` found +} + +fn main() {} diff --git a/tests/ui/issues/issue-23217.stderr b/tests/ui/issues/issue-23217.stderr new file mode 100644 index 000000000..5d3d8a4f8 --- /dev/null +++ b/tests/ui/issues/issue-23217.stderr @@ -0,0 +1,14 @@ +error[E0599]: no variant or associated item named `A` found for enum `SomeEnum` in the current scope + --> $DIR/issue-23217.rs:2:19 + | +LL | pub enum SomeEnum { + | ----------------- variant or associated item `A` not found for this enum +LL | B = SomeEnum::A, + | ^ + | | + | variant or associated item not found in `SomeEnum` + | help: there is a variant with a similar name: `B` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-23253.rs b/tests/ui/issues/issue-23253.rs new file mode 100644 index 000000000..22b55c285 --- /dev/null +++ b/tests/ui/issues/issue-23253.rs @@ -0,0 +1,6 @@ +enum Foo { Bar } + +fn main() { + Foo::Bar.a; + //~^ no field `a` on type `Foo` +} diff --git a/tests/ui/issues/issue-23253.stderr b/tests/ui/issues/issue-23253.stderr new file mode 100644 index 000000000..be5714cd9 --- /dev/null +++ b/tests/ui/issues/issue-23253.stderr @@ -0,0 +1,9 @@ +error[E0609]: no field `a` on type `Foo` + --> $DIR/issue-23253.rs:4:14 + | +LL | Foo::Bar.a; + | ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-23261.rs b/tests/ui/issues/issue-23261.rs new file mode 100644 index 000000000..e21f86351 --- /dev/null +++ b/tests/ui/issues/issue-23261.rs @@ -0,0 +1,61 @@ +// run-pass +// Matching on a DST struct should not trigger an LLVM assertion. + +struct Foo<T: ?Sized> { + a: i32, + inner: T +} + +trait Get { + fn get(&self) -> i32; +} + +impl Get for i32 { + fn get(&self) -> i32 { + *self + } +} + +fn check_val(val: &Foo<[u8]>) { + match *val { + Foo { a, .. } => { + assert_eq!(a, 32); + } + } +} + +fn check_dst_val(val: &Foo<[u8]>) { + match *val { + Foo { ref inner, .. } => { + assert_eq!(inner, [1, 2, 3]); + } + } +} + +fn check_both(val: &Foo<[u8]>) { + match *val { + Foo { a, ref inner } => { + assert_eq!(a, 32); + assert_eq!(inner, [1, 2, 3]); + } + } +} + +fn check_trait_obj(val: &Foo<dyn Get>) { + match *val { + Foo { a, ref inner } => { + assert_eq!(a, 32); + assert_eq!(inner.get(), 32); + } + } +} + +fn main() { + let foo: &Foo<[u8]> = &Foo { a: 32, inner: [1, 2, 3] }; + check_val(foo); + check_dst_val(foo); + check_both(foo); + + let foo: &Foo<dyn Get> = &Foo { a: 32, inner: 32 }; + check_trait_obj(foo); +} diff --git a/tests/ui/issues/issue-23281.rs b/tests/ui/issues/issue-23281.rs new file mode 100644 index 000000000..727168964 --- /dev/null +++ b/tests/ui/issues/issue-23281.rs @@ -0,0 +1,12 @@ +pub struct Struct; + +impl Struct { + pub fn function(funs: Vec<dyn Fn() -> ()>) {} + //~^ ERROR the size for values of type +} + +struct Vec<T> { + t: T, +} + +fn main() {} diff --git a/tests/ui/issues/issue-23281.stderr b/tests/ui/issues/issue-23281.stderr new file mode 100644 index 000000000..804334c9b --- /dev/null +++ b/tests/ui/issues/issue-23281.stderr @@ -0,0 +1,23 @@ +error[E0277]: the size for values of type `(dyn Fn() + 'static)` cannot be known at compilation time + --> $DIR/issue-23281.rs:4:27 + | +LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {} + | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Fn() + 'static)` +note: required by a bound in `Vec` + --> $DIR/issue-23281.rs:8:12 + | +LL | struct Vec<T> { + | ^ required by this bound in `Vec` +help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` + --> $DIR/issue-23281.rs:8:12 + | +LL | struct Vec<T> { + | ^ this could be changed to `T: ?Sized`... +LL | t: T, + | - ...if indirection were used here: `Box<T>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-23302-1.rs b/tests/ui/issues/issue-23302-1.rs new file mode 100644 index 000000000..24e79dc58 --- /dev/null +++ b/tests/ui/issues/issue-23302-1.rs @@ -0,0 +1,7 @@ +// Check that an enum with recursion in the discriminant throws +// the appropriate error (rather than, say, blowing the stack). +enum X { + A = X::A as isize, //~ ERROR E0391 +} + +fn main() { } diff --git a/tests/ui/issues/issue-23302-1.stderr b/tests/ui/issues/issue-23302-1.stderr new file mode 100644 index 000000000..9366050d7 --- /dev/null +++ b/tests/ui/issues/issue-23302-1.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when const-evaluating + checking `X::A::{constant#0}` + --> $DIR/issue-23302-1.rs:4:9 + | +LL | A = X::A as isize, + | ^^^^^^^^^^^^^ + | + = note: ...which immediately requires const-evaluating + checking `X::A::{constant#0}` again +note: cycle used when simplifying constant for the type system `X::A::{constant#0}` + --> $DIR/issue-23302-1.rs:4:9 + | +LL | A = X::A as isize, + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-23302-2.rs b/tests/ui/issues/issue-23302-2.rs new file mode 100644 index 000000000..e89c7eab5 --- /dev/null +++ b/tests/ui/issues/issue-23302-2.rs @@ -0,0 +1,8 @@ +// Since `Y::B` here defaults to `Y::A+1`, this is also a +// recursive definition. +enum Y { + A = Y::B as isize, //~ ERROR E0391 + B, +} + +fn main() { } diff --git a/tests/ui/issues/issue-23302-2.stderr b/tests/ui/issues/issue-23302-2.stderr new file mode 100644 index 000000000..b97ae287a --- /dev/null +++ b/tests/ui/issues/issue-23302-2.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when const-evaluating + checking `Y::A::{constant#0}` + --> $DIR/issue-23302-2.rs:4:9 + | +LL | A = Y::B as isize, + | ^^^^^^^^^^^^^ + | + = note: ...which immediately requires const-evaluating + checking `Y::A::{constant#0}` again +note: cycle used when simplifying constant for the type system `Y::A::{constant#0}` + --> $DIR/issue-23302-2.rs:4:9 + | +LL | A = Y::B as isize, + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-23302-3.rs b/tests/ui/issues/issue-23302-3.rs new file mode 100644 index 000000000..da75f3307 --- /dev/null +++ b/tests/ui/issues/issue-23302-3.rs @@ -0,0 +1,5 @@ +const A: i32 = B; //~ ERROR cycle detected + +const B: i32 = A; + +fn main() { } diff --git a/tests/ui/issues/issue-23302-3.stderr b/tests/ui/issues/issue-23302-3.stderr new file mode 100644 index 000000000..c6cafe575 --- /dev/null +++ b/tests/ui/issues/issue-23302-3.stderr @@ -0,0 +1,21 @@ +error[E0391]: cycle detected when const-evaluating + checking `A` + --> $DIR/issue-23302-3.rs:1:16 + | +LL | const A: i32 = B; + | ^ + | +note: ...which requires const-evaluating + checking `B`... + --> $DIR/issue-23302-3.rs:3:16 + | +LL | const B: i32 = A; + | ^ + = note: ...which again requires const-evaluating + checking `A`, completing the cycle +note: cycle used when simplifying constant for the type system `A` + --> $DIR/issue-23302-3.rs:1:1 + | +LL | const A: i32 = B; + | ^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-23304-1.rs b/tests/ui/issues/issue-23304-1.rs new file mode 100644 index 000000000..1805c1c19 --- /dev/null +++ b/tests/ui/issues/issue-23304-1.rs @@ -0,0 +1,25 @@ +// run-pass +#![allow(dead_code)] + +#[repr(u8)] +#[allow(dead_code)] +enum ValueType { + DOUBLE = 0x00, + INT32 = 0x01, +} + +#[repr(u32)] +enum ValueTag { + INT32 = 0x1FFF0u32 | (ValueType::INT32 as u32), + X, +} + +#[repr(u64)] +enum ValueShiftedTag { + INT32 = ValueTag::INT32 as u64, + X, +} + +fn main() { + println!("{}", ValueTag::INT32 as u32); +} diff --git a/tests/ui/issues/issue-23304-2.rs b/tests/ui/issues/issue-23304-2.rs new file mode 100644 index 000000000..6376fdb65 --- /dev/null +++ b/tests/ui/issues/issue-23304-2.rs @@ -0,0 +1,13 @@ +// run-pass +#![allow(dead_code)] + +enum X { A = 42 as isize } + +enum Y { A = X::A as isize } + +fn main() { + let x = X::A; + let x = x as isize; + assert_eq!(x, 42); + assert_eq!(Y::A as isize, 42); +} diff --git a/tests/ui/issues/issue-23311.rs b/tests/ui/issues/issue-23311.rs new file mode 100644 index 000000000..62c96840b --- /dev/null +++ b/tests/ui/issues/issue-23311.rs @@ -0,0 +1,11 @@ +// run-pass + +// Test that we do not ICE when pattern matching an array against a slice. + +fn main() { + match "foo".as_bytes() { + b"food" => (), + &[b'f', ..] => (), + _ => () + } +} diff --git a/tests/ui/issues/issue-23336.rs b/tests/ui/issues/issue-23336.rs new file mode 100644 index 000000000..cd71d7eed --- /dev/null +++ b/tests/ui/issues/issue-23336.rs @@ -0,0 +1,11 @@ +// run-pass +pub trait Data { fn doit(&self) {} } +impl<T> Data for T {} +pub trait UnaryLogic { type D: Data; } +impl UnaryLogic for () { type D = i32; } + +pub fn crashes<T: UnaryLogic>(t: T::D) { + t.doit(); +} + +fn main() { crashes::<()>(0); } diff --git a/tests/ui/issues/issue-23354-2.rs b/tests/ui/issues/issue-23354-2.rs new file mode 100644 index 000000000..c291d8a5e --- /dev/null +++ b/tests/ui/issues/issue-23354-2.rs @@ -0,0 +1,9 @@ +// run-fail +// error-pattern:panic evaluated +// ignore-emscripten no processes + +#[allow(unused_variables)] +fn main() { + // This used to trigger an LLVM assertion during compilation + let x = [panic!("panic evaluated"); 2]; +} diff --git a/tests/ui/issues/issue-23354.rs b/tests/ui/issues/issue-23354.rs new file mode 100644 index 000000000..8b7c2eef2 --- /dev/null +++ b/tests/ui/issues/issue-23354.rs @@ -0,0 +1,8 @@ +// run-fail +// error-pattern:panic evaluated +// ignore-emscripten no processes + +#[allow(unused_variables)] +fn main() { + let x = [panic!("panic evaluated"); 0]; +} diff --git a/tests/ui/issues/issue-23406.rs b/tests/ui/issues/issue-23406.rs new file mode 100644 index 000000000..d00d5d6f9 --- /dev/null +++ b/tests/ui/issues/issue-23406.rs @@ -0,0 +1,15 @@ +// build-pass +#![allow(dead_code)] +trait Inner { + type T; +} + +impl<'a> Inner for &'a i32 { + type T = i32; +} + +fn f<'a>(x: &'a i32) -> <&'a i32 as Inner>::T { + *x +} + +fn main() {} diff --git a/tests/ui/issues/issue-23433.rs b/tests/ui/issues/issue-23433.rs new file mode 100644 index 000000000..d4fbbde62 --- /dev/null +++ b/tests/ui/issues/issue-23433.rs @@ -0,0 +1,13 @@ +// run-pass +// Don't fail if we encounter a NonNull<T> where T is an unsized type + +use std::ptr::NonNull; + +fn main() { + let mut a = [0u8; 5]; + let b: Option<NonNull<[u8]>> = Some(NonNull::from(&mut a)); + match b { + Some(_) => println!("Got `Some`"), + None => panic!("Unexpected `None`"), + } +} diff --git a/tests/ui/issues/issue-23442.rs b/tests/ui/issues/issue-23442.rs new file mode 100644 index 000000000..d1e4317e5 --- /dev/null +++ b/tests/ui/issues/issue-23442.rs @@ -0,0 +1,23 @@ +// check-pass +#![allow(dead_code)] +use std::marker::PhantomData; + +pub struct UnionedKeys<'a,K> + where K: UnifyKey + 'a +{ + table: &'a mut UnificationTable<K>, + root_key: K, + stack: Vec<K>, +} + +pub trait UnifyKey { + type Value; +} + +pub struct UnificationTable<K:UnifyKey> { + values: Delegate<K>, +} + +pub struct Delegate<K>(PhantomData<K>); + +fn main() {} diff --git a/tests/ui/issues/issue-23477.rs b/tests/ui/issues/issue-23477.rs new file mode 100644 index 000000000..988ebe03c --- /dev/null +++ b/tests/ui/issues/issue-23477.rs @@ -0,0 +1,16 @@ +// build-pass +// ignore-asmjs wasm2js does not support source maps yet +// compile-flags: -g + +pub struct Dst { + pub a: (), + pub b: (), + pub data: [u8], +} + +pub unsafe fn borrow(bytes: &[u8]) -> &Dst { + let dst: &Dst = std::mem::transmute((bytes.as_ptr(), bytes.len())); + dst +} + +fn main() {} diff --git a/tests/ui/issues/issue-23485.rs b/tests/ui/issues/issue-23485.rs new file mode 100644 index 000000000..1dd3d9293 --- /dev/null +++ b/tests/ui/issues/issue-23485.rs @@ -0,0 +1,50 @@ +// run-pass +#![allow(unused_imports)] +// Test for an ICE that occurred when a default method implementation +// was applied to a type that did not meet the prerequisites. The +// problem occurred specifically because normalizing +// `Self::Item::Target` was impossible in this case. + +use std::boxed::Box; +use std::marker::Sized; +use std::clone::Clone; +use std::ops::Deref; +use std::option::Option; +use std::option::Option::{Some,None}; + +trait Iterator { + type Item; + + fn next(&mut self) -> Option<Self::Item>; + + fn clone_first(mut self) -> Option<<Self::Item as Deref>::Target> where + Self: Sized, + Self::Item: Deref, + <Self::Item as Deref>::Target: Clone, + { + self.next().map(|x| x.clone()) + } +} + +struct Counter { + value: i32 +} + +struct Token { + value: i32 +} + +impl Iterator for Counter { + type Item = Token; + + fn next(&mut self) -> Option<Token> { + let x = self.value; + self.value += 1; + Some(Token { value: x }) + } +} + +fn main() { + let mut x: Box<dyn Iterator<Item=Token>> = Box::new(Counter { value: 22 }); + assert_eq!(x.next().unwrap().value, 22); +} diff --git a/tests/ui/issues/issue-23491.rs b/tests/ui/issues/issue-23491.rs new file mode 100644 index 000000000..e5f9dd3ef --- /dev/null +++ b/tests/ui/issues/issue-23491.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(unused_variables)] + +struct Node<T: ?Sized>(#[allow(unused_tuple_struct_fields)] T); + +fn main() { + let x: Box<Node<[isize]>> = Box::new(Node([])); +} diff --git a/tests/ui/issues/issue-23543.rs b/tests/ui/issues/issue-23543.rs new file mode 100644 index 000000000..843e1a8a8 --- /dev/null +++ b/tests/ui/issues/issue-23543.rs @@ -0,0 +1,11 @@ +pub trait A: Copy {} + +struct Foo; + +pub trait D { + fn f<T>(self) + where T<Bogus = Foo>: A; + //~^ ERROR associated type bindings are not allowed here [E0229] +} + +fn main() {} diff --git a/tests/ui/issues/issue-23543.stderr b/tests/ui/issues/issue-23543.stderr new file mode 100644 index 000000000..ebb70afe3 --- /dev/null +++ b/tests/ui/issues/issue-23543.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-23543.rs:7:17 + | +LL | where T<Bogus = Foo>: A; + | ^^^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/issues/issue-23544.rs b/tests/ui/issues/issue-23544.rs new file mode 100644 index 000000000..6ad00b2fb --- /dev/null +++ b/tests/ui/issues/issue-23544.rs @@ -0,0 +1,9 @@ +pub trait A: Copy {} + +pub trait D { + fn f<T>(self) + where T<Bogus = Self::AlsoBogus>: A; + //~^ ERROR associated type bindings are not allowed here [E0229] +} + +fn main() {} diff --git a/tests/ui/issues/issue-23544.stderr b/tests/ui/issues/issue-23544.stderr new file mode 100644 index 000000000..c912baccb --- /dev/null +++ b/tests/ui/issues/issue-23544.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-23544.rs:5:17 + | +LL | where T<Bogus = Self::AlsoBogus>: A; + | ^^^^^^^^^^^^^^^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/issues/issue-23550.rs b/tests/ui/issues/issue-23550.rs new file mode 100644 index 000000000..9cce9a0a9 --- /dev/null +++ b/tests/ui/issues/issue-23550.rs @@ -0,0 +1,22 @@ +// build-pass +#![feature(core_intrinsics)] +#![allow(warnings)] + +use std::intrinsics; + +#[derive(Copy, Clone)] +struct Wrap(i64); + +// These volatile intrinsics used to cause an ICE + +unsafe fn test_bool(p: &mut bool, v: bool) { + intrinsics::volatile_load(p); + intrinsics::volatile_store(p, v); +} + +unsafe fn test_immediate_fca(p: &mut Wrap, v: Wrap) { + intrinsics::volatile_load(p); + intrinsics::volatile_store(p, v); +} + +fn main() {} diff --git a/tests/ui/issues/issue-23589.rs b/tests/ui/issues/issue-23589.rs new file mode 100644 index 000000000..1c640af8d --- /dev/null +++ b/tests/ui/issues/issue-23589.rs @@ -0,0 +1,5 @@ +fn main() { + let v: Vec(&str) = vec!['1', '2']; + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + //~| ERROR mismatched types +} diff --git a/tests/ui/issues/issue-23589.stderr b/tests/ui/issues/issue-23589.stderr new file mode 100644 index 000000000..1a91f5e04 --- /dev/null +++ b/tests/ui/issues/issue-23589.stderr @@ -0,0 +1,26 @@ +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-23589.rs:2:12 + | +LL | let v: Vec(&str) = vec!['1', '2']; + | ^^^^^^^^^ only `Fn` traits may use parentheses + | +help: use angle brackets instead + | +LL | let v: Vec<&str> = vec!['1', '2']; + | ~ ~ + +error[E0308]: mismatched types + --> $DIR/issue-23589.rs:2:29 + | +LL | let v: Vec(&str) = vec!['1', '2']; + | ^^^ expected `&str`, found `char` + | +help: if you meant to write a `str` literal, use double quotes + | +LL | let v: Vec(&str) = vec!["1", '2']; + | ~~~ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0214, E0308. +For more information about an error, try `rustc --explain E0214`. diff --git a/tests/ui/issues/issue-23611-enum-swap-in-drop.rs b/tests/ui/issues/issue-23611-enum-swap-in-drop.rs new file mode 100644 index 000000000..cdb130d60 --- /dev/null +++ b/tests/ui/issues/issue-23611-enum-swap-in-drop.rs @@ -0,0 +1,259 @@ +// run-pass +#![allow(non_upper_case_globals)] + +// Issue 23611: this test is ensuring that, for an instance `X` of the +// enum `E`, if you swap in a different variant during the execution +// of the `<E as Drop>::drop`, then the appropriate substructure will +// be torn down after the `<E as Drop>::drop` method returns. + +use std::cell::RefCell; +use std::mem; + +use self::d::D; + +pub fn main() { + let log = RefCell::new(vec![]); + d::println("created empty log"); + test(&log); + + // println!("log: {:?}", &log.borrow()[..]); + assert_eq!( + &log.borrow()[..], + [ + // created empty log + // +-- Make D(test_1, 10000000) + // | +-- Make D(g_b_5, 50000001) + // | | in g_B(b2b0) from E::drop, b=b4b0 + // | +-- Drop D(g_b_5, 50000001) + 50000001, + // | + // | +-- Make D(drop_6, 60000002) + // | | +-- Make D(g_b_5, 50000003) + // | | | in g_B(b2b0) from E::drop, b=b4b1 + // | | +-- Drop D(g_b_5, 50000003) + 50000003, + // | | + // | | +-- Make D(GaspB::drop_3, 30000004) + // | | | +-- Make D(g_b_5, 50000005) + // | | | | in g_B(b4b2) from GaspB::drop + // | | | +-- Drop D(g_b_5, 50000005) + 50000005, + // | | | + // | | +-- Drop D(GaspB::drop_3, 30000004) + 30000004, + // | | + // +-- Drop D(test_1, 10000000) + 10000000, + // | + // +-- Make D(GaspA::drop_2, 20000006) + // | | +-- Make D(f_a_4, 40000007) + // | | | in f_A(a3a0) from GaspA::drop + // | | +-- Drop D(f_a_4, 40000007) + 40000007, + // | | + // +-- Drop D(GaspA::drop_2, 20000006) + 20000006, + // | + // +-- Drop D(drop_6, 60000002) + 60000002 + // + ]); + + // For reference purposes, the old (incorrect) behavior would produce the following + // output, which you can compare to the above: + // + // created empty log + // +-- Make D(test_1, 10000000) + // | +-- Make D(g_b_5, 50000001) + // | | in g_B(b2b0) from E::drop, b=b4b0 + // | +-- Drop D(g_b_5, 50000001) + // | + // | +-- Make D(drop_6, 60000002) + // | | +-- Make D(g_b_5, 50000003) + // | | | in g_B(b2b0) from E::drop, b=b4b1 + // | | +-- Drop D(g_b_5, 50000003) + // | | + // | | +-- Make D(GaspB::drop_3, 30000004) + // | | | +-- Make D(g_b_5, 50000005) + // | | | | in g_B(b4b2) from GaspB::drop + // | | | +-- Drop D(g_b_5, 50000005) + // | | | + // | | +-- Drop D(GaspB::drop_3, 30000004) + // | | + // +-- Drop D(test_1, 10000000) + // | + // +-- Make D(GaspB::drop_3, 30000006) + // | | +-- Make D(f_a_4, 40000007) + // | | | in f_A(a3a0) from GaspB::drop + // | | +-- Drop D(f_a_4, 40000007) + // | | + // +-- Drop D(GaspB::drop_3, 30000006) + // | + // +-- Drop D(drop_6, 60000002) + + // Note that this calls f_A from GaspB::drop (and thus creates a D + // with a uid incorporating the origin of GaspB's drop that + // surrounds the f_A invocation), but the code as written only + // ever hands f_A off to instances of GaspA, and thus one should + // be able to prove the invariant that f_A is *only* invoked from + // from an instance of GaspA (either via the GaspA drop + // implementation or the E drop implementation). Yet the old (bad) + // behavior allowed a call to f_A to leak in while we are tearing + // down a value of type GaspB. +} + +fn test<'a>(log: d::Log<'a>) { + let _e = E::B(GaspB(g_b, 0xB4B0, log, D::new("test", 1, log)), true); +} + +struct GaspA<'a>(for <'b> fn(u32, &'b str, d::Log<'a>), u32, d::Log<'a>, d::D<'a>); +struct GaspB<'a>(for <'b> fn(u32, &'b str, d::Log<'a>), u32, d::Log<'a>, d::D<'a>); + +impl<'a> Drop for GaspA<'a> { + fn drop(&mut self) { + let _d = d::D::new("GaspA::drop", 2, self.2); + (self.0)(self.1, "GaspA::drop", self.2); + } +} + +impl<'a> Drop for GaspB<'a> { + fn drop(&mut self) { + let _d = d::D::new("GaspB::drop", 3, self.2); + (self.0)(self.1, "GaspB::drop", self.2); + } +} + +enum E<'a> { + A(GaspA<'a>, bool), B(GaspB<'a>, bool), +} + +fn f_a(x: u32, ctxt: &str, log: d::Log) { + let _d = d::D::new("f_a", 4, log); + d::println(&format!("in f_A({:x}) from {}", x, ctxt)); +} +fn g_b(y: u32, ctxt: &str, log: d::Log) { + let _d = d::D::new("g_b", 5, log); + d::println(&format!("in g_B({:x}) from {}", y, ctxt)); +} + +impl<'a> Drop for E<'a> { + fn drop(&mut self) { + let (do_drop, log) = match *self { + E::A(GaspA(ref f, ref mut val_a, log, ref _d_a), ref mut do_drop) => { + f(0xA1A0, &format!("E::drop, a={:x}", val_a), log); + *val_a += 1; + // swap in do_drop := false to avoid infinite dtor regress + (mem::replace(do_drop, false), log) + } + E::B(GaspB(ref g, ref mut val_b, log, ref _d_b), ref mut do_drop) => { + g(0xB2B0, &format!("E::drop, b={:x}", val_b), log); + *val_b += 1; + // swap in do_drop := false to avoid infinite dtor regress + (mem::replace(do_drop, false), log) + } + }; + + #[allow(unused_must_use)] + if do_drop { + mem::replace(self, E::A(GaspA(f_a, 0xA3A0, log, D::new("drop", 6, log)), true)); + } + } +} + +// This module provides simultaneous printouts of the dynamic extents +// of all of the D values, in addition to logging the order that each +// is dropped. +// +// This code is similar to a support code module embedded within +// test/run-pass/issue-123338-ensure-param-drop-order.rs; however, +// that (slightly simpler) code only identifies objects in the log via +// (creation) time-stamps; this incorporates both timestamping and the +// point of origin within the source code into the unique ID (uid). + +const PREF_INDENT: u32 = 20; + +pub mod d { + #![allow(unused_parens)] + use std::fmt; + use std::mem; + use std::cell::RefCell; + + static mut counter: u16 = 0; + static mut trails: u64 = 0; + + pub type Log<'a> = &'a RefCell<Vec<u32>>; + + pub fn current_width() -> u32 { + unsafe { max_width() - trails.leading_zeros() } + } + + pub fn max_width() -> u32 { + unsafe { + (mem::size_of_val(&trails)*8) as u32 + } + } + + pub fn indent_println(my_trails: u32, s: &str) { + let mut indent: String = String::new(); + for i in 0..my_trails { + unsafe { + if trails & (1 << i) != 0 { + indent = indent + "| "; + } else { + indent = indent + " "; + } + } + } + println!("{}{}", indent, s); + } + + pub fn println(s: &str) { + indent_println(super::PREF_INDENT, s); + } + + fn first_avail() -> u32 { + unsafe { + for i in 0..64 { + if trails & (1 << i) == 0 { + return i; + } + } + } + panic!("exhausted trails"); + } + + pub struct D<'a> { + name: &'static str, i: u8, uid: u32, trail: u32, log: Log<'a> + } + + impl<'a> fmt::Display for D<'a> { + fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { + write!(w, "D({}_{}, {})", self.name, self.i, self.uid) + } + } + + impl<'a> D<'a> { + pub fn new(name: &'static str, i: u8, log: Log<'a>) -> D<'a> { + unsafe { + let trail = first_avail(); + let ctr = ((i as u32) * 10_000_000) + (counter as u32); + counter += 1; + trails |= (1 << trail); + let ret = D { + name: name, i: i, log: log, uid: ctr, trail: trail + }; + indent_println(trail, &format!("+-- Make {}", ret)); + ret + } + } + } + + impl<'a> Drop for D<'a> { + fn drop(&mut self) { + unsafe { trails &= !(1 << self.trail); }; + self.log.borrow_mut().push(self.uid); + indent_println(self.trail, &format!("+-- Drop {}", self)); + indent_println(::PREF_INDENT, ""); + } + } +} diff --git a/tests/ui/issues/issue-23649-1.rs b/tests/ui/issues/issue-23649-1.rs new file mode 100644 index 000000000..fc0c9a605 --- /dev/null +++ b/tests/ui/issues/issue-23649-1.rs @@ -0,0 +1,12 @@ +// run-pass +use std::mem; + +pub struct X([u8]); + +fn _f(x: &X) -> usize { match *x { X(ref x) => { x.len() } } } + +fn main() { + let b: &[u8] = &[11; 42]; + let v: &X = unsafe { mem::transmute(b) }; + assert_eq!(_f(v), 42); +} diff --git a/tests/ui/issues/issue-23649-2.rs b/tests/ui/issues/issue-23649-2.rs new file mode 100644 index 000000000..ce7d8e3a7 --- /dev/null +++ b/tests/ui/issues/issue-23649-2.rs @@ -0,0 +1,10 @@ +// run-pass + +use std::collections::HashMap; +use std::path::{Path, PathBuf}; + +fn main() { + let m: HashMap<PathBuf, ()> = HashMap::new(); + let k = Path::new("foo"); + println!("{:?}", m.get(k)); +} diff --git a/tests/ui/issues/issue-23649-3.rs b/tests/ui/issues/issue-23649-3.rs new file mode 100644 index 000000000..8f61c71d6 --- /dev/null +++ b/tests/ui/issues/issue-23649-3.rs @@ -0,0 +1,5 @@ +// build-pass +#[derive(PartialEq)] +struct Slice { slice: [u8] } + +fn main() {} diff --git a/tests/ui/issues/issue-23699.rs b/tests/ui/issues/issue-23699.rs new file mode 100644 index 000000000..952548837 --- /dev/null +++ b/tests/ui/issues/issue-23699.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(unused_variables)] +fn gimme_a_raw_pointer<T>(_: *const T) { } + +fn test<T>(t: T) { } + +fn main() { + // Clearly `pointer` must be of type `*const ()`. + let pointer = &() as *const _; + gimme_a_raw_pointer(pointer); + + let t = test as fn (i32); + t(0i32); +} diff --git a/tests/ui/issues/issue-23781.rs b/tests/ui/issues/issue-23781.rs new file mode 100644 index 000000000..220ebdb18 --- /dev/null +++ b/tests/ui/issues/issue-23781.rs @@ -0,0 +1,29 @@ +// run-pass +use std::fmt; + +struct Foo; +impl fmt::Debug for Foo { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + println!("<Foo as Debug>::fmt()"); + + write!(fmt, "") + } +} + +fn test1() { + let foo_str = format!("{:?}", Foo); + + println!("{}", foo_str); +} + +fn test2() { + println!("{:?}", Foo); +} + +fn main() { + // This works fine + test1(); + + // This fails + test2(); +} diff --git a/tests/ui/issues/issue-2380-b.rs b/tests/ui/issues/issue-2380-b.rs new file mode 100644 index 000000000..d708c7b42 --- /dev/null +++ b/tests/ui/issues/issue-2380-b.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-2380.rs + +// pretty-expanded FIXME #23616 + +extern crate a; + +pub fn main() { + a::f::<()>(); +} diff --git a/tests/ui/issues/issue-23808.rs b/tests/ui/issues/issue-23808.rs new file mode 100644 index 000000000..0988b09fc --- /dev/null +++ b/tests/ui/issues/issue-23808.rs @@ -0,0 +1,59 @@ +// run-pass + +#![deny(dead_code)] + +// use different types / traits to test all combinations + +trait Const { + const C: (); +} + +trait StaticFn { + fn sfn(); +} + +struct ConstStruct; +struct StaticFnStruct; + +enum ConstEnum {} +enum StaticFnEnum {} + +struct AliasedConstStruct; +struct AliasedStaticFnStruct; + +enum AliasedConstEnum {} +enum AliasedStaticFnEnum {} + +type AliasConstStruct = AliasedConstStruct; +type AliasStaticFnStruct = AliasedStaticFnStruct; +type AliasConstEnum = AliasedConstEnum; +type AliasStaticFnEnum = AliasedStaticFnEnum; + +macro_rules! impl_Const {($($T:ident),*) => {$( + impl Const for $T { + const C: () = (); + } +)*}} + +macro_rules! impl_StaticFn {($($T:ident),*) => {$( + impl StaticFn for $T { + fn sfn() {} + } +)*}} + +impl_Const!(ConstStruct, ConstEnum, AliasedConstStruct, AliasedConstEnum); +impl_StaticFn!(StaticFnStruct, StaticFnEnum, AliasedStaticFnStruct, AliasedStaticFnEnum); + +fn main() { + let _ = ConstStruct::C; + let _ = ConstEnum::C; + + StaticFnStruct::sfn(); + StaticFnEnum::sfn(); + + let _ = AliasConstStruct::C; + let _ = AliasConstEnum::C; + + AliasStaticFnStruct::sfn(); + AliasStaticFnEnum::sfn(); +} diff --git a/tests/ui/issues/issue-2383.rs b/tests/ui/issues/issue-2383.rs new file mode 100644 index 000000000..06e61ce68 --- /dev/null +++ b/tests/ui/issues/issue-2383.rs @@ -0,0 +1,9 @@ +// run-pass +// pretty-expanded FIXME #23616 + +use std::collections::VecDeque; + +pub fn main() { + let mut q = VecDeque::new(); + q.push_front(10); +} diff --git a/tests/ui/issues/issue-23891.rs b/tests/ui/issues/issue-23891.rs new file mode 100644 index 000000000..73467f715 --- /dev/null +++ b/tests/ui/issues/issue-23891.rs @@ -0,0 +1,11 @@ +// run-pass +macro_rules! id { + ($s: pat) => ($s); +} + +fn main() { + match (Some(123), Some(456)) { + (id!(Some(a)), _) | (_, id!(Some(a))) => println!("{}", a), + _ => (), + } +} diff --git a/tests/ui/issues/issue-23898.rs b/tests/ui/issues/issue-23898.rs new file mode 100644 index 000000000..3de365675 --- /dev/null +++ b/tests/ui/issues/issue-23898.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(unused_parens)] +#![allow(non_camel_case_types)] + +// Note: This test was used to demonstrate #5873 (now #23898). + +enum State { ST_NULL, ST_WHITESPACE } + +fn main() { + [State::ST_NULL; (State::ST_WHITESPACE as usize)]; +} diff --git a/tests/ui/issues/issue-23958.rs b/tests/ui/issues/issue-23958.rs new file mode 100644 index 000000000..7e90d7586 --- /dev/null +++ b/tests/ui/issues/issue-23958.rs @@ -0,0 +1,13 @@ +// run-pass +trait Collection where for<'a> &'a Self: IntoIterator { + fn my_iter(&self) -> <&Self as IntoIterator>::IntoIter { + self.into_iter() + } +} + +impl<T> Collection for [T] { } + +fn main() { + let v = [0usize]; + let _ = v.my_iter(); +} diff --git a/tests/ui/issues/issue-23966.rs b/tests/ui/issues/issue-23966.rs new file mode 100644 index 000000000..5fdec28ac --- /dev/null +++ b/tests/ui/issues/issue-23966.rs @@ -0,0 +1,4 @@ +fn main() { + "".chars().fold(|_, _| (), ()); + //~^ ERROR E0277 +} diff --git a/tests/ui/issues/issue-23966.stderr b/tests/ui/issues/issue-23966.stderr new file mode 100644 index 000000000..8f934481d --- /dev/null +++ b/tests/ui/issues/issue-23966.stderr @@ -0,0 +1,15 @@ +error[E0277]: expected a `FnMut<(_, char)>` closure, found `()` + --> $DIR/issue-23966.rs:2:32 + | +LL | "".chars().fold(|_, _| (), ()); + | ---- ^^ expected an `FnMut<(_, char)>` closure, found `()` + | | + | required by a bound introduced by this call + | + = help: the trait `FnMut<(_, char)>` is not implemented for `()` +note: required by a bound in `fold` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-23992.rs b/tests/ui/issues/issue-23992.rs new file mode 100644 index 000000000..1ff44bd7f --- /dev/null +++ b/tests/ui/issues/issue-23992.rs @@ -0,0 +1,19 @@ +// run-pass +pub struct Outer<T: Trait>(T); +pub struct Inner<'a> { value: &'a bool } + +pub trait Trait { + type Error; + fn ready(self) -> Self::Error; +} + +impl<'a> Trait for Inner<'a> { + type Error = Outer<Inner<'a>>; + fn ready(self) -> Outer<Inner<'a>> { Outer(self) } +} + +fn main() { + let value = true; + let inner = Inner { value: &value }; + assert_eq!(inner.ready().0.value, &value); +} diff --git a/tests/ui/issues/issue-24013.rs b/tests/ui/issues/issue-24013.rs new file mode 100644 index 000000000..c6d301671 --- /dev/null +++ b/tests/ui/issues/issue-24013.rs @@ -0,0 +1,7 @@ +fn main() { + use std::mem::{transmute, swap}; + let a = 1; + let b = 2; + unsafe {swap::<&mut _>(transmute(&a), transmute(&b))}; + //~^ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-24013.stderr b/tests/ui/issues/issue-24013.stderr new file mode 100644 index 000000000..72102f460 --- /dev/null +++ b/tests/ui/issues/issue-24013.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/issue-24013.rs:5:13 + | +LL | unsafe {swap::<&mut _>(transmute(&a), transmute(&b))}; + | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `swap` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-24036.rs b/tests/ui/issues/issue-24036.rs new file mode 100644 index 000000000..7df036c8e --- /dev/null +++ b/tests/ui/issues/issue-24036.rs @@ -0,0 +1,16 @@ +fn closure_to_loc() { + let mut x = |c| c + 1; + x = |c| c + 1; + //~^ ERROR mismatched types +} + +fn closure_from_match() { + let x = match 1usize { + 1 => |c| c + 1, + 2 => |c| c - 1, + _ => |c| c - 1 + }; + //~^^^^ ERROR type annotations needed +} + +fn main() { } diff --git a/tests/ui/issues/issue-24036.stderr b/tests/ui/issues/issue-24036.stderr new file mode 100644 index 000000000..0e73a51fa --- /dev/null +++ b/tests/ui/issues/issue-24036.stderr @@ -0,0 +1,28 @@ +error[E0308]: mismatched types + --> $DIR/issue-24036.rs:3:9 + | +LL | let mut x = |c| c + 1; + | --- the expected closure +LL | x = |c| c + 1; + | ^^^^^^^^^ expected closure, found a different closure + | + = note: expected closure `[closure@$DIR/issue-24036.rs:2:17: 2:20]` + found closure `[closure@$DIR/issue-24036.rs:3:9: 3:12]` + = note: no two closures, even if identical, have the same type + = help: consider boxing your closure and/or using it as a trait object + +error[E0282]: type annotations needed + --> $DIR/issue-24036.rs:9:15 + | +LL | 1 => |c| c + 1, + | ^ + | +help: consider giving this closure parameter an explicit type + | +LL | 1 => |c: /* Type */| c + 1, + | ++++++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0282, E0308. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-24086.rs b/tests/ui/issues/issue-24086.rs new file mode 100644 index 000000000..54622afbc --- /dev/null +++ b/tests/ui/issues/issue-24086.rs @@ -0,0 +1,23 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(unused_variables)] +pub struct Registry<'a> { + listener: &'a mut (), +} + +pub struct Listener<'a> { + pub announce: Option<Box<dyn FnMut(&mut Registry) + 'a>>, + pub remove: Option<Box<dyn FnMut(&mut Registry) + 'a>>, +} + +impl<'a> Drop for Registry<'a> { + fn drop(&mut self) {} +} + +fn main() { + let mut registry_listener = Listener { + announce: None, + remove: None, + }; +} diff --git a/tests/ui/issues/issue-2414-c.rs b/tests/ui/issues/issue-2414-c.rs new file mode 100644 index 000000000..f6fe97980 --- /dev/null +++ b/tests/ui/issues/issue-2414-c.rs @@ -0,0 +1,9 @@ +// run-pass +// aux-build:issue-2414-a.rs +// aux-build:issue-2414-b.rs + +// pretty-expanded FIXME #23616 + +extern crate b; + +pub fn main() {} diff --git a/tests/ui/issues/issue-24161.rs b/tests/ui/issues/issue-24161.rs new file mode 100644 index 000000000..f4cdd982a --- /dev/null +++ b/tests/ui/issues/issue-24161.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(dead_code)] +#[derive(Copy,Clone)] +struct Functions { + a: fn(u32) -> u32, + b: extern "C" fn(u32) -> u32, + c: unsafe fn(u32) -> u32, + d: unsafe extern "C" fn(u32) -> u32 +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-24227.rs b/tests/ui/issues/issue-24227.rs new file mode 100644 index 000000000..12816c235 --- /dev/null +++ b/tests/ui/issues/issue-24227.rs @@ -0,0 +1,18 @@ +// check-pass +// This resulted in an ICE. Test for future-proofing +// Issue #24227 + +#![allow(unused)] + +struct Foo<'a> { + x: &'a u8 +} + +impl<'a> Foo<'a> { + fn foo() { + let mut tmp: Self; + } + +} + +fn main() {} diff --git a/tests/ui/issues/issue-2428.rs b/tests/ui/issues/issue-2428.rs new file mode 100644 index 000000000..94b830de3 --- /dev/null +++ b/tests/ui/issues/issue-2428.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(non_upper_case_globals)] + + +pub fn main() { + let _foo = 100; + const quux: isize = 5; + + enum Stuff { + Bar = quux + } + + assert_eq!(Stuff::Bar as isize, quux); +} diff --git a/tests/ui/issues/issue-24308.rs b/tests/ui/issues/issue-24308.rs new file mode 100644 index 000000000..4a582c68e --- /dev/null +++ b/tests/ui/issues/issue-24308.rs @@ -0,0 +1,17 @@ +// run-pass +pub trait Foo { + fn method1() {} + fn method2(); +} + +struct Slice<'a, T: 'a>(#[allow(unused_tuple_struct_fields)] &'a [T]); + +impl<'a, T: 'a> Foo for Slice<'a, T> { + fn method2() { + <Self as Foo>::method1(); + } +} + +fn main() { + <Slice<()> as Foo>::method2(); +} diff --git a/tests/ui/issues/issue-24322.rs b/tests/ui/issues/issue-24322.rs new file mode 100644 index 000000000..6567fcab4 --- /dev/null +++ b/tests/ui/issues/issue-24322.rs @@ -0,0 +1,9 @@ +struct B; + +impl B { + fn func(&self) -> u32 { 42 } +} + +fn main() { + let x: &fn(&B) -> u32 = &B::func; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-24322.stderr b/tests/ui/issues/issue-24322.stderr new file mode 100644 index 000000000..1e4c8ac7c --- /dev/null +++ b/tests/ui/issues/issue-24322.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-24322.rs:8:29 + | +LL | let x: &fn(&B) -> u32 = &B::func; + | -------------- ^^^^^^^^ expected fn pointer, found fn item + | | + | expected due to this + | + = note: expected reference `&for<'a> fn(&'a B) -> u32` + found reference `&for<'a> fn(&'a B) -> u32 {B::func}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-24352.rs b/tests/ui/issues/issue-24352.rs new file mode 100644 index 000000000..5c8246d17 --- /dev/null +++ b/tests/ui/issues/issue-24352.rs @@ -0,0 +1,4 @@ +fn main() { + 1.0f64 - 1.0; + 1.0f64 - 1 //~ ERROR E0277 +} diff --git a/tests/ui/issues/issue-24352.stderr b/tests/ui/issues/issue-24352.stderr new file mode 100644 index 000000000..1f51b6e29 --- /dev/null +++ b/tests/ui/issues/issue-24352.stderr @@ -0,0 +1,20 @@ +error[E0277]: cannot subtract `{integer}` from `f64` + --> $DIR/issue-24352.rs:3:12 + | +LL | 1.0f64 - 1 + | ^ no implementation for `f64 - {integer}` + | + = help: the trait `Sub<{integer}>` is not implemented for `f64` + = help: the following other types implement trait `Sub<Rhs>`: + <&'a f64 as Sub<f64>> + <&f64 as Sub<&f64>> + <f64 as Sub<&f64>> + <f64 as Sub> +help: consider using a floating-point literal by writing it with `.0` + | +LL | 1.0f64 - 1.0 + | ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-24353.rs b/tests/ui/issues/issue-24353.rs new file mode 100644 index 000000000..f78255b7e --- /dev/null +++ b/tests/ui/issues/issue-24353.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(unreachable_code)] +fn main() { + return (); + + let x = (); + x +} diff --git a/tests/ui/issues/issue-24357.rs b/tests/ui/issues/issue-24357.rs new file mode 100644 index 000000000..152e69ebc --- /dev/null +++ b/tests/ui/issues/issue-24357.rs @@ -0,0 +1,11 @@ +struct NoCopy; +fn main() { + let x = NoCopy; + //~^ NOTE move occurs because `x` has type `NoCopy` + let f = move || { let y = x; }; + //~^ NOTE value moved into closure here + //~| NOTE variable moved due to use in closure + let z = x; + //~^ ERROR use of moved value: `x` + //~| NOTE value used here after move +} diff --git a/tests/ui/issues/issue-24357.stderr b/tests/ui/issues/issue-24357.stderr new file mode 100644 index 000000000..b9e15f5e2 --- /dev/null +++ b/tests/ui/issues/issue-24357.stderr @@ -0,0 +1,17 @@ +error[E0382]: use of moved value: `x` + --> $DIR/issue-24357.rs:8:12 + | +LL | let x = NoCopy; + | - move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait +LL | +LL | let f = move || { let y = x; }; + | ------- - variable moved due to use in closure + | | + | value moved into closure here +... +LL | let z = x; + | ^ value used here after move + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-24363.rs b/tests/ui/issues/issue-24363.rs new file mode 100644 index 000000000..34726fba9 --- /dev/null +++ b/tests/ui/issues/issue-24363.rs @@ -0,0 +1,6 @@ +fn main() { + 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields + ()+() //~ ERROR cannot add + // ^ ensure that we typeck the inner expression ^ + ]; +} diff --git a/tests/ui/issues/issue-24363.stderr b/tests/ui/issues/issue-24363.stderr new file mode 100644 index 000000000..16537e21a --- /dev/null +++ b/tests/ui/issues/issue-24363.stderr @@ -0,0 +1,18 @@ +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/issue-24363.rs:2:7 + | +LL | 1.create_a_type_error[ + | ^^^^^^^^^^^^^^^^^^^ + +error[E0369]: cannot add `()` to `()` + --> $DIR/issue-24363.rs:3:11 + | +LL | ()+() + | --^-- () + | | + | () + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0369, E0610. +For more information about an error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-24365.rs b/tests/ui/issues/issue-24365.rs new file mode 100644 index 000000000..eca104b6f --- /dev/null +++ b/tests/ui/issues/issue-24365.rs @@ -0,0 +1,19 @@ +pub enum Attribute { + Code {attr_name_idx: u16}, +} + +pub enum Foo { + Bar +} + +fn test(a: Foo) { + println!("{}", a.b); //~ no field `b` on type `Foo` +} + +fn main() { + let x = Attribute::Code { + attr_name_idx: 42, + }; + let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute` + let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute` +} diff --git a/tests/ui/issues/issue-24365.stderr b/tests/ui/issues/issue-24365.stderr new file mode 100644 index 000000000..f9eead8a4 --- /dev/null +++ b/tests/ui/issues/issue-24365.stderr @@ -0,0 +1,21 @@ +error[E0609]: no field `b` on type `Foo` + --> $DIR/issue-24365.rs:10:22 + | +LL | println!("{}", a.b); + | ^ + +error[E0609]: no field `attr_name_idx` on type `&Attribute` + --> $DIR/issue-24365.rs:17:18 + | +LL | let z = (&x).attr_name_idx; + | ^^^^^^^^^^^^^ + +error[E0609]: no field `attr_name_idx` on type `Attribute` + --> $DIR/issue-24365.rs:18:15 + | +LL | let y = x.attr_name_idx; + | ^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-24389.rs b/tests/ui/issues/issue-24389.rs new file mode 100644 index 000000000..7cc761176 --- /dev/null +++ b/tests/ui/issues/issue-24389.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(dead_code)] + +struct Foo; + +impl Foo { + fn new() -> Self { Foo } + fn bar() { Self::new(); } +} + +fn main() {} diff --git a/tests/ui/issues/issue-24424.rs b/tests/ui/issues/issue-24424.rs new file mode 100644 index 000000000..22bf513af --- /dev/null +++ b/tests/ui/issues/issue-24424.rs @@ -0,0 +1,7 @@ +trait Trait1<'l0, T0> {} +trait Trait0<'l0> {} + +impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} +//~^ ERROR type annotations needed + +fn main() {} diff --git a/tests/ui/issues/issue-24424.stderr b/tests/ui/issues/issue-24424.stderr new file mode 100644 index 000000000..50d7f988e --- /dev/null +++ b/tests/ui/issues/issue-24424.stderr @@ -0,0 +1,15 @@ +error[E0283]: type annotations needed: cannot satisfy `T0: Trait0<'l0>` + --> $DIR/issue-24424.rs:4:57 + | +LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} + | ^^^^^^^^^^^ + | +note: multiple `impl`s or `where` clauses satisfying `T0: Trait0<'l0>` found + --> $DIR/issue-24424.rs:4:57 + | +LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} + | ^^^^^^^^^^^ ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/issues/issue-24434.rs b/tests/ui/issues/issue-24434.rs new file mode 100644 index 000000000..4c1bfc03c --- /dev/null +++ b/tests/ui/issues/issue-24434.rs @@ -0,0 +1,7 @@ +// check-pass +// compile-flags:--cfg set1 + +#![cfg_attr(set1, feature(rustc_attrs))] +#![rustc_dummy] + +fn main() {} diff --git a/tests/ui/issues/issue-24446.rs b/tests/ui/issues/issue-24446.rs new file mode 100644 index 000000000..9ab952ade --- /dev/null +++ b/tests/ui/issues/issue-24446.rs @@ -0,0 +1,7 @@ +fn main() { + static foo: dyn Fn() -> u32 = || -> u32 { + //~^ ERROR the size for values of type + //~| ERROR cannot be shared between threads safely + 0 + }; +} diff --git a/tests/ui/issues/issue-24446.stderr b/tests/ui/issues/issue-24446.stderr new file mode 100644 index 000000000..4afb87c48 --- /dev/null +++ b/tests/ui/issues/issue-24446.stderr @@ -0,0 +1,20 @@ +error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time + --> $DIR/issue-24446.rs:2:17 + | +LL | static foo: dyn Fn() -> u32 = || -> u32 { + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)` + +error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely + --> $DIR/issue-24446.rs:2:17 + | +LL | static foo: dyn Fn() -> u32 = || -> u32 { + | ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)` + = note: shared static variables must have a type that implements `Sync` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-2445-b.rs b/tests/ui/issues/issue-2445-b.rs new file mode 100644 index 000000000..f369eae3a --- /dev/null +++ b/tests/ui/issues/issue-2445-b.rs @@ -0,0 +1,31 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct c1<T> { + x: T, +} + +impl<T> c1<T> { + pub fn f1(&self, _x: isize) { + } +} + +fn c1<T>(x: T) -> c1<T> { + c1 { + x: x + } +} + +impl<T> c1<T> { + pub fn f2(&self, _x: isize) { + } +} + + +pub fn main() { + c1::<isize>(3).f1(4); + c1::<isize>(3).f2(4); +} diff --git a/tests/ui/issues/issue-2445.rs b/tests/ui/issues/issue-2445.rs new file mode 100644 index 000000000..5730ce165 --- /dev/null +++ b/tests/ui/issues/issue-2445.rs @@ -0,0 +1,29 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct c1<T> { + x: T, +} + +impl<T> c1<T> { + pub fn f1(&self, _x: T) {} +} + +fn c1<T>(x: T) -> c1<T> { + c1 { + x: x + } +} + +impl<T> c1<T> { + pub fn f2(&self, _x: T) {} +} + + +pub fn main() { + c1::<isize>(3).f1(4); + c1::<isize>(3).f2(4); +} diff --git a/tests/ui/issues/issue-24533.rs b/tests/ui/issues/issue-24533.rs new file mode 100644 index 000000000..8592bf430 --- /dev/null +++ b/tests/ui/issues/issue-24533.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(unused_must_use)] +use std::slice::Iter; +use std::io::{Error, ErrorKind, Result}; +use std::vec::*; + +fn foo(it: &mut Iter<u8>) -> Result<u8> { + Ok(*it.next().unwrap()) +} + +fn bar() -> Result<u8> { + let data: Vec<u8> = Vec::new(); + + if true { + return Err(Error::new(ErrorKind::NotFound, "msg")); + } + + let mut it = data.iter(); + foo(&mut it) +} + +fn main() { + bar(); +} diff --git a/tests/ui/issues/issue-24589.rs b/tests/ui/issues/issue-24589.rs new file mode 100644 index 000000000..6b03e14f9 --- /dev/null +++ b/tests/ui/issues/issue-24589.rs @@ -0,0 +1,17 @@ +// run-pass +pub struct _X([u8]); + +impl std::ops::Deref for _X { + type Target = [u8]; + + fn deref(&self) -> &[u8] { + &self.0 + } +} + +pub fn _g(x: &_X) -> &[u8] { + x +} + +fn main() { +} diff --git a/tests/ui/issues/issue-2463.rs b/tests/ui/issues/issue-2463.rs new file mode 100644 index 000000000..d24a47c53 --- /dev/null +++ b/tests/ui/issues/issue-2463.rs @@ -0,0 +1,25 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +struct Pair { f: isize, g: isize } + +pub fn main() { + + let x = Pair { + f: 0, + g: 0, + }; + + let _y = Pair { + f: 1, + g: 1, + .. x + }; + + let _z = Pair { + f: 1, + .. x + }; + +} diff --git a/tests/ui/issues/issue-24682.rs b/tests/ui/issues/issue-24682.rs new file mode 100644 index 000000000..0d1ab7341 --- /dev/null +++ b/tests/ui/issues/issue-24682.rs @@ -0,0 +1,21 @@ +trait A: Sized { + type N; + fn x() -> + Self< + N= //~ ERROR associated type bindings are not allowed here + Self::N> { + loop {} + } + fn y(&self) -> + std + <N=()> //~ ERROR associated type bindings are not allowed here + ::option::Option<()> + { None } + fn z(&self) -> + u32<N=()> //~ ERROR associated type bindings are not allowed here + { 42 } + +} + +fn main() { +} diff --git a/tests/ui/issues/issue-24682.stderr b/tests/ui/issues/issue-24682.stderr new file mode 100644 index 000000000..e1943bf4d --- /dev/null +++ b/tests/ui/issues/issue-24682.stderr @@ -0,0 +1,22 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-24682.rs:5:11 + | +LL | / N= +LL | | Self::N> { + | |_________________^ associated type not allowed here + +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-24682.rs:11:13 + | +LL | <N=()> + | ^^^^ associated type not allowed here + +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-24682.rs:15:13 + | +LL | u32<N=()> + | ^^^^ associated type not allowed here + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs b/tests/ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs new file mode 100644 index 000000000..5b1b1389c --- /dev/null +++ b/tests/ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs @@ -0,0 +1,10 @@ +#![crate_type="lib"] + +// This is a file that pulls in a separate file as a submodule, where +// that separate file has many multi-byte characters, to try to +// encourage the compiler to trip on them. + +#[path = "issue-24687-mbcs-in-comments.rs"] +mod issue_24687_mbcs_in_comments; + +pub use issue_24687_mbcs_in_comments::D; diff --git a/tests/ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs b/tests/ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs new file mode 100644 index 000000000..215145a64 --- /dev/null +++ b/tests/ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs @@ -0,0 +1,27 @@ +use std::fmt; + +// This ia file with many multi-byte characters, to try to encourage +// the compiler to trip on them. The Drop implementation below will +// need to have its source location embedded into the debug info for +// the output file. + +// αααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααα +// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ +// γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ +// δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ +// εεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεε + +// ζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζ +// ηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηη +// θθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθ +// ιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι +// κκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκ + +pub struct D<X:fmt::Debug>(pub X); + +impl<X:fmt::Debug> Drop for D<X> { + fn drop(&mut self) { + // λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ + println!("Dropping D({:?})", self.0); + } +} diff --git a/tests/ui/issues/issue-24687-embed-debuginfo/main.rs b/tests/ui/issues/issue-24687-embed-debuginfo/main.rs new file mode 100644 index 000000000..f08bcdfe6 --- /dev/null +++ b/tests/ui/issues/issue-24687-embed-debuginfo/main.rs @@ -0,0 +1,14 @@ +// run-pass +// aux-build:issue-24687-lib.rs +// compile-flags:-g +// ignore-asmjs wasm2js does not support source maps yet + +extern crate issue_24687_lib as d; + +fn main() { + // Create a `D`, which has a destructor whose body will be codegen'ed + // into the generated code here, and thus the local debuginfo will + // need references into the original source locations from + // `importer` above. + let _d = d::D("Hi"); +} diff --git a/tests/ui/issues/issue-2470-bounds-check-overflow.rs b/tests/ui/issues/issue-2470-bounds-check-overflow.rs new file mode 100644 index 000000000..f0e8e185e --- /dev/null +++ b/tests/ui/issues/issue-2470-bounds-check-overflow.rs @@ -0,0 +1,27 @@ +// run-fail +// error-pattern:index out of bounds +// ignore-emscripten no processes + +use std::mem; + +fn main() { + + // This should cause a bounds-check panic, but may not if we do our + // bounds checking by comparing the scaled index to the vector's + // address-bounds, since we've scaled the index to wrap around to the + // address of the 0th cell in the array (even though the index is + // huge). + + let x = vec![1_usize, 2_usize, 3_usize]; + + let base = x.as_ptr() as usize; + let idx = base / mem::size_of::<usize>(); + println!("ov1 base = 0x{:x}", base); + println!("ov1 idx = 0x{:x}", idx); + println!("ov1 sizeof::<usize>() = 0x{:x}", mem::size_of::<usize>()); + println!("ov1 idx * sizeof::<usize>() = 0x{:x}", + idx * mem::size_of::<usize>()); + + // This should panic. + println!("ov1 0x{:x}", x[idx]); +} diff --git a/tests/ui/issues/issue-2472.rs b/tests/ui/issues/issue-2472.rs new file mode 100644 index 000000000..c790bc2d0 --- /dev/null +++ b/tests/ui/issues/issue-2472.rs @@ -0,0 +1,14 @@ +// run-pass +// aux-build:issue-2472-b.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_2472_b; + +use issue_2472_b::{S, T}; + +pub fn main() { + let s = S(()); + s.foo(); + s.bar(); +} diff --git a/tests/ui/issues/issue-24779.rs b/tests/ui/issues/issue-24779.rs new file mode 100644 index 000000000..f1283d0dc --- /dev/null +++ b/tests/ui/issues/issue-24779.rs @@ -0,0 +1,4 @@ +// run-pass +fn main() { + assert_eq!((||||42)()(), 42); +} diff --git a/tests/ui/issues/issue-24819.rs b/tests/ui/issues/issue-24819.rs new file mode 100644 index 000000000..59c3f2cd1 --- /dev/null +++ b/tests/ui/issues/issue-24819.rs @@ -0,0 +1,11 @@ +use std::collections::HashSet; + +fn main() { + let mut v = Vec::new(); + foo(&mut v); + //~^ ERROR mismatched types + //~| expected struct `HashSet`, found struct `Vec` +} + +fn foo(h: &mut HashSet<u32>) { +} diff --git a/tests/ui/issues/issue-24819.stderr b/tests/ui/issues/issue-24819.stderr new file mode 100644 index 000000000..982a11fef --- /dev/null +++ b/tests/ui/issues/issue-24819.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-24819.rs:5:9 + | +LL | foo(&mut v); + | --- ^^^^^^ expected struct `HashSet`, found struct `Vec` + | | + | arguments to this function are incorrect + | + = note: expected mutable reference `&mut HashSet<u32>` + found mutable reference `&mut Vec<_>` +note: function defined here + --> $DIR/issue-24819.rs:10:4 + | +LL | fn foo(h: &mut HashSet<u32>) { + | ^^^ -------------------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-2487-a.rs b/tests/ui/issues/issue-2487-a.rs new file mode 100644 index 000000000..fe12dad74 --- /dev/null +++ b/tests/ui/issues/issue-2487-a.rs @@ -0,0 +1,32 @@ +// build-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct socket { + sock: isize, + +} + +impl Drop for socket { + fn drop(&mut self) {} +} + +impl socket { + pub fn set_identity(&self) { + closure(|| setsockopt_bytes(self.sock.clone())) + } +} + +fn socket() -> socket { + socket { + sock: 1 + } +} + +fn closure<F>(f: F) where F: FnOnce() { f() } + +fn setsockopt_bytes(_sock: isize) { } + +pub fn main() {} diff --git a/tests/ui/issues/issue-24945-repeat-dash-opts.rs b/tests/ui/issues/issue-24945-repeat-dash-opts.rs new file mode 100644 index 000000000..0f92fc2f7 --- /dev/null +++ b/tests/ui/issues/issue-24945-repeat-dash-opts.rs @@ -0,0 +1,10 @@ +// run-pass +// This test is just checking that we continue to accept `-g -g -O -O` +// as options to the compiler. + +// compile-flags:-g -g -O -O +// ignore-asmjs wasm2js does not support source maps yet + +fn main() { + assert_eq!(1, 1); +} diff --git a/tests/ui/issues/issue-24947.rs b/tests/ui/issues/issue-24947.rs new file mode 100644 index 000000000..23705b4c9 --- /dev/null +++ b/tests/ui/issues/issue-24947.rs @@ -0,0 +1,25 @@ +// run-pass +// #24947 ICE using a trait-associated const in an array size + + +struct Foo; + +impl Foo { + const SIZE: usize = 8; +} + +trait Bar { + const BAR_SIZE: usize; +} + +impl Bar for Foo { + const BAR_SIZE: usize = 12; +} + +#[allow(unused_variables)] +fn main() { + let w: [u8; 12] = [0u8; <Foo as Bar>::BAR_SIZE]; + let x: [u8; 12] = [0u8; <Foo>::BAR_SIZE]; + let y: [u8; 8] = [0u8; <Foo>::SIZE]; + let z: [u8; 8] = [0u8; Foo::SIZE]; +} diff --git a/tests/ui/issues/issue-24954.rs b/tests/ui/issues/issue-24954.rs new file mode 100644 index 000000000..0177dd4ea --- /dev/null +++ b/tests/ui/issues/issue-24954.rs @@ -0,0 +1,13 @@ +// run-pass +macro_rules! foo { + ($y:expr) => ({ + $y = 2; + }) +} + +#[allow(unused_variables)] +#[allow(unused_assignments)] +fn main() { + let mut x = 1; + foo!(x); +} diff --git a/tests/ui/issues/issue-2502.rs b/tests/ui/issues/issue-2502.rs new file mode 100644 index 000000000..631510024 --- /dev/null +++ b/tests/ui/issues/issue-2502.rs @@ -0,0 +1,24 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + + +// pretty-expanded FIXME #23616 + +struct font<'a> { + fontbuf: &'a Vec<u8> , +} + +impl<'a> font<'a> { + pub fn buf(&self) -> &'a Vec<u8> { + self.fontbuf + } +} + +fn font(fontbuf: &Vec<u8> ) -> font { + font { + fontbuf: fontbuf + } +} + +pub fn main() { } diff --git a/tests/ui/issues/issue-25076.rs b/tests/ui/issues/issue-25076.rs new file mode 100644 index 000000000..6c5a55392 --- /dev/null +++ b/tests/ui/issues/issue-25076.rs @@ -0,0 +1,11 @@ +struct S; + +trait InOut<T> { type Out; } + +fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {} + +fn bot<T>() -> T { loop {} } + +fn main() { + do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied +} diff --git a/tests/ui/issues/issue-25076.stderr b/tests/ui/issues/issue-25076.stderr new file mode 100644 index 000000000..159cc484c --- /dev/null +++ b/tests/ui/issues/issue-25076.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `(): InOut<_>` is not satisfied + --> $DIR/issue-25076.rs:10:20 + | +LL | do_fold(bot(), ()); + | ------- ^^ the trait `InOut<_>` is not implemented for `()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `do_fold` + --> $DIR/issue-25076.rs:5:18 + | +LL | fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {} + | ^^^^^^^^^^^^^^^ required by this bound in `do_fold` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-25089.rs b/tests/ui/issues/issue-25089.rs new file mode 100644 index 000000000..c988f8f55 --- /dev/null +++ b/tests/ui/issues/issue-25089.rs @@ -0,0 +1,34 @@ +// run-pass +// needs-unwind +// ignore-emscripten no threads support + +use std::thread; + +struct Foo(#[allow(unused_tuple_struct_fields)] i32); + +impl Drop for Foo { + fn drop(&mut self) { + static mut DROPPED: bool = false; + unsafe { + assert!(!DROPPED); + DROPPED = true; + } + } +} + +struct Empty; + +fn empty() -> Empty { Empty } + +fn should_panic(_: Foo, _: Empty) { + panic!("test panic"); +} + +fn test() { + should_panic(Foo(1), empty()); +} + +fn main() { + let ret = thread::spawn(test).join(); + assert!(ret.is_err()); +} diff --git a/tests/ui/issues/issue-25145.rs b/tests/ui/issues/issue-25145.rs new file mode 100644 index 000000000..f5ae28fbb --- /dev/null +++ b/tests/ui/issues/issue-25145.rs @@ -0,0 +1,13 @@ +// run-pass + +struct S; + +impl S { + const N: usize = 3; +} + +static STUFF: [u8; S::N] = [0; S::N]; + +fn main() { + assert_eq!(STUFF, [0; 3]); +} diff --git a/tests/ui/issues/issue-25180.rs b/tests/ui/issues/issue-25180.rs new file mode 100644 index 000000000..29dc07f49 --- /dev/null +++ b/tests/ui/issues/issue-25180.rs @@ -0,0 +1,7 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +const x: &'static dyn Fn() = &|| println!("ICE here"); + +fn main() {} diff --git a/tests/ui/issues/issue-25185.rs b/tests/ui/issues/issue-25185.rs new file mode 100644 index 000000000..383c9a1e9 --- /dev/null +++ b/tests/ui/issues/issue-25185.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:issue-25185-1.rs +// aux-build:issue-25185-2.rs +// ignore-wasm32-bare no libc for ffi testing + +extern crate issue_25185_2; + +fn main() { + let x = unsafe { + issue_25185_2::rust_dbg_extern_identity_u32(1) + }; + assert_eq!(x, 1); +} diff --git a/tests/ui/issues/issue-2526-a.rs b/tests/ui/issues/issue-2526-a.rs new file mode 100644 index 000000000..f3fdc0bd3 --- /dev/null +++ b/tests/ui/issues/issue-2526-a.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-2526.rs + +// pretty-expanded FIXME #23616 + +#![allow(unused_imports)] + +extern crate issue_2526; +use issue_2526::*; + +pub fn main() {} diff --git a/tests/ui/issues/issue-25279.rs b/tests/ui/issues/issue-25279.rs new file mode 100644 index 000000000..fdc516d37 --- /dev/null +++ b/tests/ui/issues/issue-25279.rs @@ -0,0 +1,16 @@ +// run-pass +struct S<'a>(&'a ()); + +impl<'a> S<'a> { + fn foo(self) -> &'a () { + <Self>::bar(self) + } + + fn bar(self) -> &'a () { + self.0 + } +} + +fn main() { + S(&()).foo(); +} diff --git a/tests/ui/issues/issue-25343.rs b/tests/ui/issues/issue-25343.rs new file mode 100644 index 000000000..95a0bd915 --- /dev/null +++ b/tests/ui/issues/issue-25343.rs @@ -0,0 +1,22 @@ +// run-pass +#[allow(unused)] +fn main() { + || { + 'label: loop { + } + }; + + // More cases added from issue 31754 + + 'label2: loop { + break; + } + + let closure = || { + 'label2: loop {} + }; + + fn inner_fn() { + 'label2: loop {} + } +} diff --git a/tests/ui/issues/issue-25368.rs b/tests/ui/issues/issue-25368.rs new file mode 100644 index 000000000..4be83457f --- /dev/null +++ b/tests/ui/issues/issue-25368.rs @@ -0,0 +1,14 @@ +use std::sync::mpsc::channel; +use std::thread::spawn; +use std::marker::PhantomData; + +struct Foo<T> {foo: PhantomData<T>} + +fn main() { + let (tx, rx) = + channel(); + spawn(move || { + tx.send(Foo{ foo: PhantomData }); + //~^ ERROR type annotations needed + }); +} diff --git a/tests/ui/issues/issue-25368.stderr b/tests/ui/issues/issue-25368.stderr new file mode 100644 index 000000000..e6ed3aac7 --- /dev/null +++ b/tests/ui/issues/issue-25368.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-25368.rs:11:27 + | +LL | tx.send(Foo{ foo: PhantomData }); + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `PhantomData` + | +help: consider specifying the generic argument + | +LL | tx.send(Foo{ foo: PhantomData::<T> }); + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-25386.rs b/tests/ui/issues/issue-25386.rs new file mode 100644 index 000000000..b26cc7768 --- /dev/null +++ b/tests/ui/issues/issue-25386.rs @@ -0,0 +1,27 @@ +mod stuff { + pub struct Item { + c_object: Box<CObj>, + } + pub struct CObj { + name: Option<String>, + } + impl Item { + pub fn new() -> Item { + Item { + c_object: Box::new(CObj { name: None }), + } + } + } +} + +macro_rules! check_ptr_exist { + ($var:expr, $member:ident) => ( + (*$var.c_object).$member.is_some() + //~^ ERROR field `c_object` of struct `Item` is private + ); +} + +fn main() { + let item = stuff::Item::new(); + println!("{}", check_ptr_exist!(item, name)); +} diff --git a/tests/ui/issues/issue-25386.stderr b/tests/ui/issues/issue-25386.stderr new file mode 100644 index 000000000..727b96908 --- /dev/null +++ b/tests/ui/issues/issue-25386.stderr @@ -0,0 +1,14 @@ +error[E0616]: field `c_object` of struct `Item` is private + --> $DIR/issue-25386.rs:19:16 + | +LL | (*$var.c_object).$member.is_some() + | ^^^^^^^^ private field +... +LL | println!("{}", check_ptr_exist!(item, name)); + | ---------------------------- in this macro invocation + | + = note: this error originates in the macro `check_ptr_exist` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0616`. diff --git a/tests/ui/issues/issue-25394.rs b/tests/ui/issues/issue-25394.rs new file mode 100644 index 000000000..2f0ae19fc --- /dev/null +++ b/tests/ui/issues/issue-25394.rs @@ -0,0 +1,6 @@ +// check-pass +#![allow(dead_code)] +#[derive(Debug)] +struct Row<T>([T]); + +fn main() {} diff --git a/tests/ui/issues/issue-25439.rs b/tests/ui/issues/issue-25439.rs new file mode 100644 index 000000000..4f73ff3e3 --- /dev/null +++ b/tests/ui/issues/issue-25439.rs @@ -0,0 +1,9 @@ +struct Helper<'a, F: 'a>(&'a F); + +fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 { + f(Helper(&f), 8) +} + +fn main() { + fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644] +} diff --git a/tests/ui/issues/issue-25439.stderr b/tests/ui/issues/issue-25439.stderr new file mode 100644 index 000000000..dadae23fd --- /dev/null +++ b/tests/ui/issues/issue-25439.stderr @@ -0,0 +1,19 @@ +error[E0644]: closure/generator type that references itself + --> $DIR/issue-25439.rs:8:9 + | +LL | fix(|_, x| x); + | ^^^^^^ cyclic type of infinite size + | + = note: closures cannot capture themselves or take themselves as argument; + this error may be the result of a recent compiler bug-fix, + see issue #46062 <https://github.com/rust-lang/rust/issues/46062> + for more information +note: required by a bound in `fix` + --> $DIR/issue-25439.rs:3:33 + | +LL | fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `fix` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0644`. diff --git a/tests/ui/issues/issue-25467.rs b/tests/ui/issues/issue-25467.rs new file mode 100644 index 000000000..31ac5f0f3 --- /dev/null +++ b/tests/ui/issues/issue-25467.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(unused_variables)] +// aux-build:issue-25467.rs + +pub type Issue25467BarT = (); +pub type Issue25467FooT = (); + +extern crate issue_25467 as aux; + +fn main() { + let o: aux::Object = None; +} diff --git a/tests/ui/issues/issue-25497.rs b/tests/ui/issues/issue-25497.rs new file mode 100644 index 000000000..25f5ab90f --- /dev/null +++ b/tests/ui/issues/issue-25497.rs @@ -0,0 +1,19 @@ +// run-pass +#[derive(Clone, Debug, PartialEq)] +enum Expression { + Dummy, + Add(Box<Expression>), +} + +use Expression::*; + +fn simplify(exp: Expression) -> Expression { + match exp { + Add(n) => *n.clone(), + _ => Dummy + } +} + +fn main() { + assert_eq!(simplify(Add(Box::new(Dummy))), Dummy); +} diff --git a/tests/ui/issues/issue-2550.rs b/tests/ui/issues/issue-2550.rs new file mode 100644 index 000000000..04ec66b80 --- /dev/null +++ b/tests/ui/issues/issue-2550.rs @@ -0,0 +1,22 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_snake_case)] + +// pretty-expanded FIXME #23616 + +struct C { + x: usize, +} + +fn C(x: usize) -> C { + C { + x: x + } +} + +fn f<T>(_x: T) { +} + +pub fn main() { + f(C(1)); +} diff --git a/tests/ui/issues/issue-25515.rs b/tests/ui/issues/issue-25515.rs new file mode 100644 index 000000000..e7b9ea3ac --- /dev/null +++ b/tests/ui/issues/issue-25515.rs @@ -0,0 +1,20 @@ +// run-pass +use std::rc::Rc; + +struct Foo<'r>(&'r mut i32); + +impl<'r> Drop for Foo<'r> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut drops = 0; + + { + let _: Rc<dyn Send> = Rc::new(Foo(&mut drops)); + } + + assert_eq!(1, drops); +} diff --git a/tests/ui/issues/issue-25549-multiple-drop.rs b/tests/ui/issues/issue-25549-multiple-drop.rs new file mode 100644 index 000000000..25a2da707 --- /dev/null +++ b/tests/ui/issues/issue-25549-multiple-drop.rs @@ -0,0 +1,33 @@ +// run-pass +#![allow(unused_variables)] +struct Foo<'r>(&'r mut i32); + +impl<'r> Drop for Foo<'r> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +trait Trait {} +impl<'r> Trait for Foo<'r> {} + +struct Holder<T: ?Sized>(T); + +fn main() { + let mut drops = 0; + + { + let y = &Holder([Foo(&mut drops)]) as &Holder<[Foo]>; + // this used to cause an extra drop of the Foo instance + let x = &y.0; + } + assert_eq!(1, drops); + + drops = 0; + { + let y = &Holder(Foo(&mut drops)) as &Holder<dyn Trait>; + // this used to cause an extra drop of the Foo instance + let x = &y.0; + } + assert_eq!(1, drops); +} diff --git a/tests/ui/issues/issue-25579.rs b/tests/ui/issues/issue-25579.rs new file mode 100644 index 000000000..5f5a0f4d2 --- /dev/null +++ b/tests/ui/issues/issue-25579.rs @@ -0,0 +1,20 @@ +// check-pass + +enum Sexpression { + Num(()), + Cons(&'static mut Sexpression) +} + +fn causes_error_in_ast(mut l: &mut Sexpression) { + loop { match l { + &mut Sexpression::Num(ref mut n) => {}, + &mut Sexpression::Cons(ref mut expr) => { + l = &mut **expr; + } + }} +} + + +fn main() { + causes_error_in_ast(&mut Sexpression::Num(())); +} diff --git a/tests/ui/issues/issue-25679.rs b/tests/ui/issues/issue-25679.rs new file mode 100644 index 000000000..b548da988 --- /dev/null +++ b/tests/ui/issues/issue-25679.rs @@ -0,0 +1,20 @@ +// run-pass +trait Device { + type Resources; +} +#[allow(unused_tuple_struct_fields)] +struct Foo<D, R>(D, R); + +impl<D: Device> Foo<D, D::Resources> { + fn present(&self) {} +} + +struct Res; +struct Dev; + +impl Device for Dev { type Resources = Res; } + +fn main() { + let foo = Foo(Dev, Res); + foo.present(); +} diff --git a/tests/ui/issues/issue-25693.rs b/tests/ui/issues/issue-25693.rs new file mode 100644 index 000000000..9af0ba100 --- /dev/null +++ b/tests/ui/issues/issue-25693.rs @@ -0,0 +1,22 @@ +// run-pass +#![allow(unused_variables)] +pub trait Parameters { type SelfRef; } + +struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> } +struct BP; + +impl<'a> Parameters for RP<'a> { type SelfRef = &'a X<RP<'a>>; } +impl Parameters for BP { type SelfRef = Box<X<BP>>; } + +pub struct Y; +pub enum X<P: Parameters> { + Nothing, + SameAgain(P::SelfRef, Y) +} + +fn main() { + let bnil: Box<X<BP>> = Box::new(X::Nothing); + let bx: Box<X<BP>> = Box::new(X::SameAgain(bnil, Y)); + let rnil: X<RP> = X::Nothing; + let rx: X<RP> = X::SameAgain(&rnil, Y); +} diff --git a/tests/ui/issues/issue-25746-bool-transmute.rs b/tests/ui/issues/issue-25746-bool-transmute.rs new file mode 100644 index 000000000..bc2f4a7c1 --- /dev/null +++ b/tests/ui/issues/issue-25746-bool-transmute.rs @@ -0,0 +1,11 @@ +// run-pass +use std::mem::transmute; + +fn main() { + unsafe { + let _: i8 = transmute(false); + let _: i8 = transmute(true); + let _: bool = transmute(0u8); + let _: bool = transmute(1u8); + } +} diff --git a/tests/ui/issues/issue-25757.rs b/tests/ui/issues/issue-25757.rs new file mode 100644 index 000000000..ec1864d7d --- /dev/null +++ b/tests/ui/issues/issue-25757.rs @@ -0,0 +1,18 @@ +// run-pass +struct Foo { + a: u32 +} + +impl Foo { + fn x(&mut self) { + self.a = 5; + } +} + +const FUNC: &'static dyn Fn(&mut Foo) -> () = &Foo::x; + +fn main() { + let mut foo = Foo { a: 137 }; + FUNC(&mut foo); + assert_eq!(foo.a, 5); +} diff --git a/tests/ui/issues/issue-25810.rs b/tests/ui/issues/issue-25810.rs new file mode 100644 index 000000000..f32216f32 --- /dev/null +++ b/tests/ui/issues/issue-25810.rs @@ -0,0 +1,28 @@ +// run-pass +fn main() { + let x = X(15); + let y = x.foo(); + println!("{:?}",y); +} + +trait Foo + where for<'a> &'a Self: Bar +{ + fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output; +} + +trait Bar { + type Output; +} + +struct X(i32); + +impl<'a> Bar for &'a X { + type Output = &'a i32; +} + +impl Foo for X { + fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output { + &self.0 + } +} diff --git a/tests/ui/issues/issue-2590.rs b/tests/ui/issues/issue-2590.rs new file mode 100644 index 000000000..a9a0e5ca4 --- /dev/null +++ b/tests/ui/issues/issue-2590.rs @@ -0,0 +1,15 @@ +struct Parser { + tokens: Vec<isize> , +} + +trait Parse { + fn parse(&self) -> Vec<isize> ; +} + +impl Parse for Parser { + fn parse(&self) -> Vec<isize> { + self.tokens //~ ERROR cannot move out + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-2590.stderr b/tests/ui/issues/issue-2590.stderr new file mode 100644 index 000000000..6aacd563a --- /dev/null +++ b/tests/ui/issues/issue-2590.stderr @@ -0,0 +1,9 @@ +error[E0507]: cannot move out of `self.tokens` which is behind a shared reference + --> $DIR/issue-2590.rs:11:9 + | +LL | self.tokens + | ^^^^^^^^^^^ move occurs because `self.tokens` has type `Vec<isize>`, which does not implement the `Copy` trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/issues/issue-25901.rs b/tests/ui/issues/issue-25901.rs new file mode 100644 index 000000000..1f7b341a9 --- /dev/null +++ b/tests/ui/issues/issue-25901.rs @@ -0,0 +1,14 @@ +struct A; +struct B; + +static S: &'static B = &A; +//~^ ERROR the trait bound + +use std::ops::Deref; + +impl Deref for A { + type Target = B; + fn deref(&self)->&B { static B_: B = B; &B_ } +} + +fn main(){} diff --git a/tests/ui/issues/issue-25901.stderr b/tests/ui/issues/issue-25901.stderr new file mode 100644 index 000000000..b9cac3222 --- /dev/null +++ b/tests/ui/issues/issue-25901.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `A: Deref` is not satisfied + --> $DIR/issue-25901.rs:4:24 + | +LL | static S: &'static B = &A; + | ^^ the trait `~const Deref` is not implemented for `A` + | +note: the trait `Deref` is implemented for `A`, but that implementation is not `const` + --> $DIR/issue-25901.rs:4:24 + | +LL | static S: &'static B = &A; + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-26056.rs b/tests/ui/issues/issue-26056.rs new file mode 100644 index 000000000..99d43ec79 --- /dev/null +++ b/tests/ui/issues/issue-26056.rs @@ -0,0 +1,22 @@ +trait MapLookup<Q> { + type MapValue; +} + +impl<K> MapLookup<K> for K { + type MapValue = K; +} + +trait Map: MapLookup<<Self as Map>::Key> { + type Key; +} + +impl<K> Map for K { + type Key = K; +} + + +fn main() { + let _ = &() + as &dyn Map<Key=u32,MapValue=u32>; + //~^ ERROR E0038 +} diff --git a/tests/ui/issues/issue-26056.stderr b/tests/ui/issues/issue-26056.stderr new file mode 100644 index 000000000..2c873243f --- /dev/null +++ b/tests/ui/issues/issue-26056.stderr @@ -0,0 +1,17 @@ +error[E0038]: the trait `Map` cannot be made into an object + --> $DIR/issue-26056.rs:20:13 + | +LL | as &dyn Map<Key=u32,MapValue=u32>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Map` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-26056.rs:9:12 + | +LL | trait Map: MapLookup<<Self as Map>::Key> { + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter + | | + | this trait cannot be made into an object... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/issues/issue-26093.rs b/tests/ui/issues/issue-26093.rs new file mode 100644 index 000000000..c838515ca --- /dev/null +++ b/tests/ui/issues/issue-26093.rs @@ -0,0 +1,12 @@ +macro_rules! not_a_place { + ($thing:expr) => { + $thing = 42; + //~^ ERROR invalid left-hand side of assignment + $thing += 42; + //~^ ERROR invalid left-hand side of assignment + } +} + +fn main() { + not_a_place!(99); +} diff --git a/tests/ui/issues/issue-26093.stderr b/tests/ui/issues/issue-26093.stderr new file mode 100644 index 000000000..1a08d0fef --- /dev/null +++ b/tests/ui/issues/issue-26093.stderr @@ -0,0 +1,32 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-26093.rs:3:16 + | +LL | $thing = 42; + | ^ +... +LL | not_a_place!(99); + | ---------------- + | | | + | | cannot assign to this expression + | in this macro invocation + | + = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0067]: invalid left-hand side of assignment + --> $DIR/issue-26093.rs:5:16 + | +LL | $thing += 42; + | ^^ +... +LL | not_a_place!(99); + | ---------------- + | | | + | | cannot assign to this expression + | in this macro invocation + | + = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0067, E0070. +For more information about an error, try `rustc --explain E0067`. diff --git a/tests/ui/issues/issue-26094.rs b/tests/ui/issues/issue-26094.rs new file mode 100644 index 000000000..d3d670aa9 --- /dev/null +++ b/tests/ui/issues/issue-26094.rs @@ -0,0 +1,13 @@ +macro_rules! some_macro { + ($other: expr) => ({ + $other(None) //~ NOTE argument of type `Option<_>` unexpected + }) +} + +fn some_function() {} //~ NOTE defined here + +fn main() { + some_macro!(some_function); + //~^ ERROR function takes 0 arguments but 1 argument was supplied + //~| NOTE in this expansion of some_macro! +} diff --git a/tests/ui/issues/issue-26094.stderr b/tests/ui/issues/issue-26094.stderr new file mode 100644 index 000000000..881a6e538 --- /dev/null +++ b/tests/ui/issues/issue-26094.stderr @@ -0,0 +1,22 @@ +error[E0061]: this function takes 0 arguments but 1 argument was supplied + --> $DIR/issue-26094.rs:10:17 + | +LL | $other(None) + | ---- argument of type `Option<_>` unexpected +... +LL | some_macro!(some_function); + | ^^^^^^^^^^^^^ + | +note: function defined here + --> $DIR/issue-26094.rs:7:4 + | +LL | fn some_function() {} + | ^^^^^^^^^^^^^ +help: remove the extra argument + | +LL | some_function() + | ~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/issues/issue-26095.rs b/tests/ui/issues/issue-26095.rs new file mode 100644 index 000000000..638f8f571 --- /dev/null +++ b/tests/ui/issues/issue-26095.rs @@ -0,0 +1,23 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + + +trait HasNumber<T> { + const Number: usize; +} + +enum One {} +enum Two {} + +enum Foo {} + +impl<T> HasNumber<T> for One { + const Number: usize = 1; +} + +impl<T> HasNumber<T> for Two { + const Number: usize = 2; +} + +fn main() {} diff --git a/tests/ui/issues/issue-2611-3.rs b/tests/ui/issues/issue-2611-3.rs new file mode 100644 index 000000000..a95a748e0 --- /dev/null +++ b/tests/ui/issues/issue-2611-3.rs @@ -0,0 +1,19 @@ +// check-pass +#![allow(dead_code)] +// Tests that impls are allowed to have looser, more permissive bounds +// than the traits require. + + +trait A { + fn b<C:Sync,D>(&self, x: C) -> C; +} + +struct E { + f: isize +} + +impl A for E { + fn b<F,G>(&self, _x: F) -> F { panic!() } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-26127.rs b/tests/ui/issues/issue-26127.rs new file mode 100644 index 000000000..f3f9c1d9a --- /dev/null +++ b/tests/ui/issues/issue-26127.rs @@ -0,0 +1,12 @@ +// run-pass +trait Tr { type T; } +impl Tr for u8 { type T=(); } +struct S<I: Tr>(#[allow(unused_tuple_struct_fields)] I::T); + +fn foo<I: Tr>(i: I::T) { + S::<I>(i); +} + +fn main() { + foo::<u8>(()); +} diff --git a/tests/ui/issues/issue-26186.rs b/tests/ui/issues/issue-26186.rs new file mode 100644 index 000000000..f93869352 --- /dev/null +++ b/tests/ui/issues/issue-26186.rs @@ -0,0 +1,62 @@ +// check-pass +use std::sync::Mutex; +use std::cell::RefCell; +use std::rc::Rc; +use std::ops::*; + +//eefriedman example +struct S<'a, T:FnMut() + 'static + ?Sized>(&'a mut T); +impl<'a, T:?Sized + FnMut() + 'static> DerefMut for S<'a, T> { + fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } +} +impl<'a, T:?Sized + FnMut() + 'static> Deref for S<'a, T> { + type Target = dyn FnMut() + 'a; + fn deref(&self) -> &Self::Target { &self.0 } +} + +//Ossipal example +struct FunctionIcon { + get_icon: Mutex<Box<dyn FnMut() -> u32>>, +} + +impl FunctionIcon { + fn get_icon(&self) -> impl '_ + std::ops::DerefMut<Target=Box<dyn FnMut() -> u32>> { + self.get_icon.lock().unwrap() + } + + fn load_icon(&self) { + let mut get_icon = self.get_icon(); + let _rgba_icon = (*get_icon)(); + } +} + +//shepmaster example +struct Foo; + +impl Deref for Foo { + type Target = dyn FnMut() + 'static; + fn deref(&self) -> &Self::Target { + unimplemented!() + } +} + +impl DerefMut for Foo { + fn deref_mut(&mut self) -> &mut Self::Target { + unimplemented!() + } +} + +fn main() { + //eefriedman example + let mut f = ||{}; + let mut s = S(&mut f); + s(); + + //Diggsey/Mark-Simulacrum example + let a: Rc<RefCell<dyn FnMut()>> = Rc::new(RefCell::new(||{})); + a.borrow_mut()(); + + //shepmaster example + let mut t = Foo; + t(); +} diff --git a/tests/ui/issues/issue-26205.rs b/tests/ui/issues/issue-26205.rs new file mode 100644 index 000000000..f5f39ded0 --- /dev/null +++ b/tests/ui/issues/issue-26205.rs @@ -0,0 +1,31 @@ +// check-pass +#![allow(dead_code)] +use std::ops::{Deref, DerefMut}; + +struct Foo; + +impl Foo { + fn foo_mut(&mut self) {} +} + +struct Bar(Foo); + +impl Deref for Bar { + type Target = Foo; + + fn deref(&self) -> &Foo { + &self.0 + } +} + +impl DerefMut for Bar { + fn deref_mut(&mut self) -> &mut Foo { + &mut self.0 + } +} + +fn test(mut bar: Box<Bar>) { + bar.foo_mut(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-26217.rs b/tests/ui/issues/issue-26217.rs new file mode 100644 index 000000000..422625e73 --- /dev/null +++ b/tests/ui/issues/issue-26217.rs @@ -0,0 +1,10 @@ +fn foo<T>() where for<'a> T: 'a {} + +fn bar<'a>() { + foo::<&'a i32>(); + //~^ ERROR lifetime may not live long enough +} + +fn main() { + bar(); +} diff --git a/tests/ui/issues/issue-26217.stderr b/tests/ui/issues/issue-26217.stderr new file mode 100644 index 000000000..73c772205 --- /dev/null +++ b/tests/ui/issues/issue-26217.stderr @@ -0,0 +1,16 @@ +error: lifetime may not live long enough + --> $DIR/issue-26217.rs:4:5 + | +LL | fn bar<'a>() { + | -- lifetime `'a` defined here +LL | foo::<&'a i32>(); + | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/issue-26217.rs:1:30 + | +LL | fn foo<T>() where for<'a> T: 'a {} + | ^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-26237.rs b/tests/ui/issues/issue-26237.rs new file mode 100644 index 000000000..71e96677d --- /dev/null +++ b/tests/ui/issues/issue-26237.rs @@ -0,0 +1,12 @@ +macro_rules! macro_panic { + ($not_a_function:expr, $some_argument:ident) => { + $not_a_function($some_argument) + } +} + +fn main() { + let mut value_a = 0; + let mut value_b = 0; + macro_panic!(value_a, value_b); + //~^ ERROR expected function, found `{integer}` +} diff --git a/tests/ui/issues/issue-26237.stderr b/tests/ui/issues/issue-26237.stderr new file mode 100644 index 000000000..91d28a5e1 --- /dev/null +++ b/tests/ui/issues/issue-26237.stderr @@ -0,0 +1,15 @@ +error[E0618]: expected function, found `{integer}` + --> $DIR/issue-26237.rs:10:18 + | +LL | $not_a_function($some_argument) + | ------------------------------- call expression requires function +... +LL | let mut value_a = 0; + | ----------- `value_a` has type `{integer}` +LL | let mut value_b = 0; +LL | macro_panic!(value_a, value_b); + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-26262.rs b/tests/ui/issues/issue-26262.rs new file mode 100644 index 000000000..41135db91 --- /dev/null +++ b/tests/ui/issues/issue-26262.rs @@ -0,0 +1,22 @@ +// Check that projections don't count as constraining type parameters. + +struct S<T>(T); + +trait Tr { type Assoc; fn test(); } + +impl<T: Tr> S<T::Assoc> { +//~^ ERROR the type parameter `T` is not constrained + fn foo(self, _: T) { + T::test(); + } +} + +trait Trait1<T> { type Bar; } +trait Trait2<'x> { type Foo; } + +impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T { +//~^ ERROR the lifetime parameter `'a` is not constrained + type Bar = &'a (); +} + +fn main() {} diff --git a/tests/ui/issues/issue-26262.stderr b/tests/ui/issues/issue-26262.stderr new file mode 100644 index 000000000..90e2d0d93 --- /dev/null +++ b/tests/ui/issues/issue-26262.stderr @@ -0,0 +1,15 @@ +error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-26262.rs:7:6 + | +LL | impl<T: Tr> S<T::Assoc> { + | ^ unconstrained type parameter + +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-26262.rs:17:6 + | +LL | impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T { + | ^^ unconstrained lifetime parameter + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/issues/issue-2631-b.rs b/tests/ui/issues/issue-2631-b.rs new file mode 100644 index 000000000..c7f6728e3 --- /dev/null +++ b/tests/ui/issues/issue-2631-b.rs @@ -0,0 +1,17 @@ +// run-pass + +// aux-build:issue-2631-a.rs + +extern crate req; + +use req::request; +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; + +pub fn main() { + let v = vec![Rc::new("hi".to_string())]; + let mut m: req::header_map = HashMap::new(); + m.insert("METHOD".to_string(), Rc::new(RefCell::new(v))); + request::<isize>(&m); +} diff --git a/tests/ui/issues/issue-2642.rs b/tests/ui/issues/issue-2642.rs new file mode 100644 index 000000000..95c563225 --- /dev/null +++ b/tests/ui/issues/issue-2642.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +fn f() { + let _x: usize = loop { loop { break; } }; +} + +pub fn main() { +} diff --git a/tests/ui/issues/issue-26468.rs b/tests/ui/issues/issue-26468.rs new file mode 100644 index 000000000..71cc90e8b --- /dev/null +++ b/tests/ui/issues/issue-26468.rs @@ -0,0 +1,29 @@ +// run-pass +#![allow(dead_code)] + +enum FooMode { + Check = 0x1001, +} + +enum BarMode { + Check = 0x2001, +} + +enum Mode { + Foo(FooMode), + Bar(BarMode), +} + +#[inline(never)] +fn broken(mode: &Mode) -> u32 { + for _ in 0..1 { + if let Mode::Foo(FooMode::Check) = *mode { return 17 } + if let Mode::Bar(BarMode::Check) = *mode { return 19 } + } + return 42; +} + +fn main() { + let mode = Mode::Bar(BarMode::Check); + assert_eq!(broken(&mode), 19); +} diff --git a/tests/ui/issues/issue-26472.rs b/tests/ui/issues/issue-26472.rs new file mode 100644 index 000000000..b100c59ad --- /dev/null +++ b/tests/ui/issues/issue-26472.rs @@ -0,0 +1,13 @@ +mod sub { + pub struct S { len: usize } + impl S { + pub fn new() -> S { S { len: 0 } } + pub fn len(&self) -> usize { self.len } + } +} + +fn main() { + let s = sub::S::new(); + let v = s.len; //~ ERROR field `len` of struct `S` is private + s.len = v; //~ ERROR field `len` of struct `S` is private +} diff --git a/tests/ui/issues/issue-26472.stderr b/tests/ui/issues/issue-26472.stderr new file mode 100644 index 000000000..d7134bff1 --- /dev/null +++ b/tests/ui/issues/issue-26472.stderr @@ -0,0 +1,20 @@ +error[E0616]: field `len` of struct `S` is private + --> $DIR/issue-26472.rs:11:15 + | +LL | let v = s.len; + | ^^^ private field + | +help: a method `len` also exists, call it with parentheses + | +LL | let v = s.len(); + | ++ + +error[E0616]: field `len` of struct `S` is private + --> $DIR/issue-26472.rs:12:7 + | +LL | s.len = v; + | ^^^ private field + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0616`. diff --git a/tests/ui/issues/issue-26484.rs b/tests/ui/issues/issue-26484.rs new file mode 100644 index 000000000..2a8750d3e --- /dev/null +++ b/tests/ui/issues/issue-26484.rs @@ -0,0 +1,12 @@ +// run-pass +// compile-flags:-g +// ignore-asmjs wasm2js does not support source maps yet + +fn helper<F: FnOnce(usize) -> bool>(_f: F) { + print!(""); +} + +fn main() { + let cond = 0; + helper(|v| v == cond) +} diff --git a/tests/ui/issues/issue-26614.rs b/tests/ui/issues/issue-26614.rs new file mode 100644 index 000000000..b8ebbdc5a --- /dev/null +++ b/tests/ui/issues/issue-26614.rs @@ -0,0 +1,14 @@ +// check-pass + +trait Mirror { + type It; +} + +impl<T> Mirror for T { + type It = Self; +} + +fn main() { + let c: <u32 as Mirror>::It = 5; + const CCCC: <u32 as Mirror>::It = 5; +} diff --git a/tests/ui/issues/issue-26619.rs b/tests/ui/issues/issue-26619.rs new file mode 100644 index 000000000..b9d34b055 --- /dev/null +++ b/tests/ui/issues/issue-26619.rs @@ -0,0 +1,22 @@ +pub struct History<'a> { pub _s: &'a str } + +impl<'a> History<'a> { + pub fn get_page(&self) { + for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + //~^ ERROR cannot return value referencing function parameter + println!("{:?}", s); + } + } + + fn make_entry(&self, s: &'a String) -> Option<&str> { + let parts: Vec<_> = s.split('|').collect(); + println!("{:?} -> {:?}", s, parts); + + if let [commit, ..] = &parts[..] { Some(commit) } else { None } + } +} + +fn main() { + let h = History{ _s: "" }; + h.get_page(); +} diff --git a/tests/ui/issues/issue-26619.stderr b/tests/ui/issues/issue-26619.stderr new file mode 100644 index 000000000..1282fd7d3 --- /dev/null +++ b/tests/ui/issues/issue-26619.stderr @@ -0,0 +1,11 @@ +error[E0515]: cannot return value referencing function parameter + --> $DIR/issue-26619.rs:5:76 + | +LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + | -------- ^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function + | | + | function parameter borrowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-26641.rs b/tests/ui/issues/issue-26641.rs new file mode 100644 index 000000000..e08edd0b5 --- /dev/null +++ b/tests/ui/issues/issue-26641.rs @@ -0,0 +1,6 @@ +// run-pass +struct Parser<'a>(#[allow(unused_tuple_struct_fields)] Box<dyn FnMut(Parser) + 'a>); + +fn main() { + let _x = Parser(Box::new(|_|{})); +} diff --git a/tests/ui/issues/issue-26646.rs b/tests/ui/issues/issue-26646.rs new file mode 100644 index 000000000..86e4bd7e8 --- /dev/null +++ b/tests/ui/issues/issue-26646.rs @@ -0,0 +1,12 @@ +// check-pass +#![deny(unused_attributes)] + +#[repr(C)] +#[repr(packed)] +pub struct Foo; + +#[repr(packed)] +#[repr(C)] +pub struct Bar; + +fn main() { } diff --git a/tests/ui/issues/issue-26655.rs b/tests/ui/issues/issue-26655.rs new file mode 100644 index 000000000..cb386c908 --- /dev/null +++ b/tests/ui/issues/issue-26655.rs @@ -0,0 +1,26 @@ +// run-pass +// needs-unwind +// ignore-emscripten no threads support + +// Check that the destructors of simple enums are run on unwinding + +use std::sync::atomic::{Ordering, AtomicUsize}; +use std::thread; + +static LOG: AtomicUsize = AtomicUsize::new(0); + +enum WithDtor { Val } +impl Drop for WithDtor { + fn drop(&mut self) { + LOG.store(LOG.load(Ordering::SeqCst)+1,Ordering::SeqCst); + } +} + +pub fn main() { + thread::spawn(move|| { + let _e: WithDtor = WithDtor::Val; + panic!("fail"); + }).join().unwrap_err(); + + assert_eq!(LOG.load(Ordering::SeqCst), 1); +} diff --git a/tests/ui/issues/issue-26709.rs b/tests/ui/issues/issue-26709.rs new file mode 100644 index 000000000..1bd2651dd --- /dev/null +++ b/tests/ui/issues/issue-26709.rs @@ -0,0 +1,17 @@ +// run-pass +struct Wrapper<'a, T: ?Sized>(&'a mut i32, #[allow(unused_tuple_struct_fields)] T); + +impl<'a, T: ?Sized> Drop for Wrapper<'a, T> { + fn drop(&mut self) { + *self.0 = 432; + } +} + +fn main() { + let mut x = 0; + { + let wrapper = Box::new(Wrapper(&mut x, 123)); + let _: Box<Wrapper<dyn Send>> = wrapper; + } + assert_eq!(432, x) +} diff --git a/tests/ui/issues/issue-26802.rs b/tests/ui/issues/issue-26802.rs new file mode 100644 index 000000000..307a67160 --- /dev/null +++ b/tests/ui/issues/issue-26802.rs @@ -0,0 +1,14 @@ +// run-pass +trait Foo<'a> { + fn bar<'b>(&self, x: &'b u8) -> u8 where 'a: 'b { *x+7 } +} + +pub struct FooBar; +impl Foo<'static> for FooBar {} +fn test(foobar: FooBar) -> Box<dyn Foo<'static>> { + Box::new(foobar) +} + +fn main() { + assert_eq!(test(FooBar).bar(&4), 11); +} diff --git a/tests/ui/issues/issue-26805.rs b/tests/ui/issues/issue-26805.rs new file mode 100644 index 000000000..bcf8a6731 --- /dev/null +++ b/tests/ui/issues/issue-26805.rs @@ -0,0 +1,6 @@ +// run-pass +struct NonOrd; + +fn main() { + let _: Box<dyn Iterator<Item = _>> = Box::new(vec![NonOrd].into_iter()); +} diff --git a/tests/ui/issues/issue-26812.rs b/tests/ui/issues/issue-26812.rs new file mode 100644 index 000000000..3391ea4b3 --- /dev/null +++ b/tests/ui/issues/issue-26812.rs @@ -0,0 +1,6 @@ +#![feature(default_type_parameter_fallback)] + +fn avg<T=T::Item>(_: T) {} +//~^ ERROR generic parameters with a default cannot use forward declared identifiers + +fn main() {} diff --git a/tests/ui/issues/issue-26812.stderr b/tests/ui/issues/issue-26812.stderr new file mode 100644 index 000000000..fd1bbb9c5 --- /dev/null +++ b/tests/ui/issues/issue-26812.stderr @@ -0,0 +1,9 @@ +error[E0128]: generic parameters with a default cannot use forward declared identifiers + --> $DIR/issue-26812.rs:3:10 + | +LL | fn avg<T=T::Item>(_: T) {} + | ^^^^^^^ defaulted generic parameters cannot be forward declared + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0128`. diff --git a/tests/ui/issues/issue-26905-rpass.rs b/tests/ui/issues/issue-26905-rpass.rs new file mode 100644 index 000000000..2d5827f47 --- /dev/null +++ b/tests/ui/issues/issue-26905-rpass.rs @@ -0,0 +1,21 @@ +// run-pass +#![feature(unsize, coerce_unsized)] + +// Verfies that PhantomData is ignored for DST coercions + +use std::marker::{Unsize, PhantomData}; +use std::ops::CoerceUnsized; + +struct MyRc<T: ?Sized> { + _ptr: *const T, + _boo: PhantomData<T>, +} + +impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } + +fn main() { + let data = [1, 2, 3]; + let iter = data.iter(); + let x = MyRc { _ptr: &iter, _boo: PhantomData }; + let _y: MyRc<dyn Iterator<Item=&u32>> = x; +} diff --git a/tests/ui/issues/issue-26905.rs b/tests/ui/issues/issue-26905.rs new file mode 100644 index 000000000..4c5c67d58 --- /dev/null +++ b/tests/ui/issues/issue-26905.rs @@ -0,0 +1,23 @@ +#![feature(unsize, coerce_unsized)] + +// Verfies that non-PhantomData ZSTs still cause coercions to fail. +// They might have additional semantics that we don't want to bulldoze. + +use std::marker::{Unsize, PhantomData}; +use std::ops::CoerceUnsized; + +struct NotPhantomData<T: ?Sized>(PhantomData<T>); + +struct MyRc<T: ?Sized> { + _ptr: *const T, + _boo: NotPhantomData<T>, +} + +impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } //~ERROR + +fn main() { + let data = [1, 2, 3]; + let iter = data.iter(); + let x = MyRc { _ptr: &iter, _boo: NotPhantomData(PhantomData) }; + let _y: MyRc<dyn Iterator<Item=&u32>> = x; +} diff --git a/tests/ui/issues/issue-26905.stderr b/tests/ui/issues/issue-26905.stderr new file mode 100644 index 000000000..10dbb7325 --- /dev/null +++ b/tests/ui/issues/issue-26905.stderr @@ -0,0 +1,12 @@ +error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions + --> $DIR/issue-26905.rs:16:40 + | +LL | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } + | ^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions + | + = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced + = note: currently, 2 fields need coercions: `_ptr` (`*const T` to `*const U`), `_boo` (`NotPhantomData<T>` to `NotPhantomData<U>`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0375`. diff --git a/tests/ui/issues/issue-26948.rs b/tests/ui/issues/issue-26948.rs new file mode 100644 index 000000000..832c9641d --- /dev/null +++ b/tests/ui/issues/issue-26948.rs @@ -0,0 +1,6 @@ +fn main() { + enum Foo { A { x: u32 } } + let orig = Foo::A { x: 5 }; + Foo::A { x: 6, ..orig }; + //~^ ERROR functional record update syntax requires a struct +} diff --git a/tests/ui/issues/issue-26948.stderr b/tests/ui/issues/issue-26948.stderr new file mode 100644 index 000000000..faede1687 --- /dev/null +++ b/tests/ui/issues/issue-26948.stderr @@ -0,0 +1,9 @@ +error[E0436]: functional record update syntax requires a struct + --> $DIR/issue-26948.rs:4:22 + | +LL | Foo::A { x: 6, ..orig }; + | ^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0436`. diff --git a/tests/ui/issues/issue-26997.rs b/tests/ui/issues/issue-26997.rs new file mode 100644 index 000000000..3653e6273 --- /dev/null +++ b/tests/ui/issues/issue-26997.rs @@ -0,0 +1,15 @@ +// build-pass +#![allow(dead_code)] +pub struct Foo { + x: isize, + y: isize +} + +impl Foo { + #[allow(improper_ctypes_definitions)] + pub extern "C" fn foo_new() -> Foo { + Foo { x: 21, y: 33 } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-27008.rs b/tests/ui/issues/issue-27008.rs new file mode 100644 index 000000000..e04de33f6 --- /dev/null +++ b/tests/ui/issues/issue-27008.rs @@ -0,0 +1,7 @@ +struct S; + +fn main() { + let b = [0; S]; + //~^ ERROR mismatched types + //~| expected `usize`, found struct `S` +} diff --git a/tests/ui/issues/issue-27008.stderr b/tests/ui/issues/issue-27008.stderr new file mode 100644 index 000000000..5b7e74c1c --- /dev/null +++ b/tests/ui/issues/issue-27008.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/issue-27008.rs:4:17 + | +LL | let b = [0; S]; + | ^ expected `usize`, found struct `S` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-27033.rs b/tests/ui/issues/issue-27033.rs new file mode 100644 index 000000000..a23819a20 --- /dev/null +++ b/tests/ui/issues/issue-27033.rs @@ -0,0 +1,12 @@ +fn main() { + match Some(1) { + None @ _ => {} //~ ERROR match bindings cannot shadow unit variants + }; + const C: u8 = 1; + match 1 { + C @ 2 => { //~ ERROR match bindings cannot shadow constant + println!("{}", C); + } + _ => {} + }; +} diff --git a/tests/ui/issues/issue-27033.stderr b/tests/ui/issues/issue-27033.stderr new file mode 100644 index 000000000..7a0ca888d --- /dev/null +++ b/tests/ui/issues/issue-27033.stderr @@ -0,0 +1,21 @@ +error[E0530]: match bindings cannot shadow unit variants + --> $DIR/issue-27033.rs:3:9 + | +LL | None @ _ => {} + | ^^^^ cannot be named the same as a unit variant + --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL + | + = note: the unit variant `None` is defined here + +error[E0530]: match bindings cannot shadow constants + --> $DIR/issue-27033.rs:7:9 + | +LL | const C: u8 = 1; + | ---------------- the constant `C` is defined here +LL | match 1 { +LL | C @ 2 => { + | ^ cannot be named the same as a constant + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0530`. diff --git a/tests/ui/issues/issue-27042.rs b/tests/ui/issues/issue-27042.rs new file mode 100644 index 000000000..517c1f2e6 --- /dev/null +++ b/tests/ui/issues/issue-27042.rs @@ -0,0 +1,17 @@ +// Regression test for #27042. Test that a loop's label is included in its span. + +fn main() { + let _: i32 = + 'a: // in this case, the citation is just the `break`: + loop { break }; //~ ERROR mismatched types + let _: i32 = + 'b: //~ ERROR mismatched types + //~^ WARN denote infinite loops with + while true { break }; // but here we cite the whole loop + let _: i32 = + 'c: //~ ERROR mismatched types + for _ in None { break }; // but here we cite the whole loop + let _: i32 = + 'd: //~ ERROR mismatched types + while let Some(_) = None { break }; +} diff --git a/tests/ui/issues/issue-27042.stderr b/tests/ui/issues/issue-27042.stderr new file mode 100644 index 000000000..59ef28481 --- /dev/null +++ b/tests/ui/issues/issue-27042.stderr @@ -0,0 +1,48 @@ +warning: denote infinite loops with `loop { ... }` + --> $DIR/issue-27042.rs:8:9 + | +LL | / 'b: +LL | | +LL | | while true { break }; // but here we cite the whole loop + | |__________________^ help: use `loop` + | + = note: `#[warn(while_true)]` on by default + +error[E0308]: mismatched types + --> $DIR/issue-27042.rs:6:16 + | +LL | loop { break }; + | ^^^^^ + | | + | expected `i32`, found `()` + | help: give it a value of the expected type: `break 42` + +error[E0308]: mismatched types + --> $DIR/issue-27042.rs:8:9 + | +LL | let _: i32 = + | --- expected due to this +LL | / 'b: +LL | | +LL | | while true { break }; // but here we cite the whole loop + | |____________________________^ expected `i32`, found `()` + +error[E0308]: mismatched types + --> $DIR/issue-27042.rs:12:9 + | +LL | / 'c: +LL | | for _ in None { break }; // but here we cite the whole loop + | |_______________________________^ expected `i32`, found `()` + +error[E0308]: mismatched types + --> $DIR/issue-27042.rs:15:9 + | +LL | let _: i32 = + | --- expected due to this +LL | / 'd: +LL | | while let Some(_) = None { break }; + | |__________________________________________^ expected `i32`, found `()` + +error: aborting due to 4 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-27054-primitive-binary-ops.rs b/tests/ui/issues/issue-27054-primitive-binary-ops.rs new file mode 100644 index 000000000..c6f925de5 --- /dev/null +++ b/tests/ui/issues/issue-27054-primitive-binary-ops.rs @@ -0,0 +1,5 @@ +// run-pass +fn main() { + let x = &mut 1; + assert_eq!(*x + { *x=2; 1 }, 2); +} diff --git a/tests/ui/issues/issue-27078.rs b/tests/ui/issues/issue-27078.rs new file mode 100644 index 000000000..5f09b9587 --- /dev/null +++ b/tests/ui/issues/issue-27078.rs @@ -0,0 +1,9 @@ +trait Foo { + const BAR: i32; + fn foo(self) -> &'static i32 { + //~^ ERROR the size for values of type + &<Self>::BAR + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-27078.stderr b/tests/ui/issues/issue-27078.stderr new file mode 100644 index 000000000..ced92bbd4 --- /dev/null +++ b/tests/ui/issues/issue-27078.stderr @@ -0,0 +1,19 @@ +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-27078.rs:3:12 + | +LL | fn foo(self) -> &'static i32 { + | ^^^^ doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider further restricting `Self` + | +LL | fn foo(self) -> &'static i32 where Self: Sized { + | +++++++++++++++++ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo(&self) -> &'static i32 { + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-2708.rs b/tests/ui/issues/issue-2708.rs new file mode 100644 index 000000000..4e53b9d14 --- /dev/null +++ b/tests/ui/issues/issue-2708.rs @@ -0,0 +1,30 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_snake_case)] + +// pretty-expanded FIXME #23616 + + + +struct Font { + fontbuf: usize, + cairo_font: usize, + font_dtor: usize, + +} + +impl Drop for Font { + fn drop(&mut self) {} +} + +fn Font() -> Font { + Font { + fontbuf: 0, + cairo_font: 0, + font_dtor: 0 + } +} + +pub fn main() { + let _f: Box<_> = Box::new(Font()); +} diff --git a/tests/ui/issues/issue-27105.rs b/tests/ui/issues/issue-27105.rs new file mode 100644 index 000000000..3339af364 --- /dev/null +++ b/tests/ui/issues/issue-27105.rs @@ -0,0 +1,15 @@ +// check-pass +use std::cell::RefCell; +use std::rc::Rc; + +pub struct Callbacks { + callbacks: Vec<Rc<RefCell<dyn FnMut(i32)>>>, +} + +impl Callbacks { + pub fn register<F: FnMut(i32)+'static>(&mut self, callback: F) { + self.callbacks.push(Rc::new(RefCell::new(callback))); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-2723-b.rs b/tests/ui/issues/issue-2723-b.rs new file mode 100644 index 000000000..1910561d0 --- /dev/null +++ b/tests/ui/issues/issue-2723-b.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-2723-a.rs + +extern crate issue_2723_a; +use issue_2723_a::f; + +pub fn main() { + unsafe { + f(vec![2]); + } +} diff --git a/tests/ui/issues/issue-27240.rs b/tests/ui/issues/issue-27240.rs new file mode 100644 index 000000000..eaf254f33 --- /dev/null +++ b/tests/ui/issues/issue-27240.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] +use std::fmt; +struct NoisyDrop<T: fmt::Debug>(#[allow(unused_tuple_struct_fields)] T); +impl<T: fmt::Debug> Drop for NoisyDrop<T> { + fn drop(&mut self) {} +} + +struct Bar<T: fmt::Debug>(#[allow(unused_tuple_struct_fields)] [*const NoisyDrop<T>; 2]); + +fn fine() { + let (u,b); + u = vec![43]; + b = Bar([&NoisyDrop(&u), &NoisyDrop(&u)]); +} + +#[allow(unused_tuple_struct_fields)] +struct Bar2<T: fmt::Debug>(*const NoisyDrop<T>, *const NoisyDrop<T>); + +fn lolwut() { + let (u,v); + u = vec![43]; + v = Bar2(&NoisyDrop(&u), &NoisyDrop(&u)); +} + +fn main() { fine(); lolwut() } diff --git a/tests/ui/issues/issue-27268.rs b/tests/ui/issues/issue-27268.rs new file mode 100644 index 000000000..161e2d4d2 --- /dev/null +++ b/tests/ui/issues/issue-27268.rs @@ -0,0 +1,4 @@ +// run-pass +fn main() { + const _C: &'static dyn Fn() = &||{}; +} diff --git a/tests/ui/issues/issue-27281.rs b/tests/ui/issues/issue-27281.rs new file mode 100644 index 000000000..717d8b2c2 --- /dev/null +++ b/tests/ui/issues/issue-27281.rs @@ -0,0 +1,17 @@ +// check-pass +pub trait Trait<'a> { + type T; + type U; + fn foo(&self, s: &'a ()) -> &'a (); +} + +impl<'a> Trait<'a> for () { + type T = &'a (); + type U = Self::T; + + fn foo(&self, s: &'a ()) -> &'a () { + let t: Self::T = s; t + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-27340.rs b/tests/ui/issues/issue-27340.rs new file mode 100644 index 000000000..61c77cc1f --- /dev/null +++ b/tests/ui/issues/issue-27340.rs @@ -0,0 +1,6 @@ +struct Foo; +#[derive(Copy, Clone)] +//~^ ERROR the trait `Copy` may not be implemented for this type +struct Bar(Foo); + +fn main() {} diff --git a/tests/ui/issues/issue-27340.stderr b/tests/ui/issues/issue-27340.stderr new file mode 100644 index 000000000..40889b866 --- /dev/null +++ b/tests/ui/issues/issue-27340.stderr @@ -0,0 +1,14 @@ +error[E0204]: the trait `Copy` may not be implemented for this type + --> $DIR/issue-27340.rs:2:10 + | +LL | #[derive(Copy, Clone)] + | ^^^^ +LL | +LL | struct Bar(Foo); + | --- this field does not implement `Copy` + | + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0204`. diff --git a/tests/ui/issues/issue-2735-2.rs b/tests/ui/issues/issue-2735-2.rs new file mode 100644 index 000000000..70ebce9d3 --- /dev/null +++ b/tests/ui/issues/issue-2735-2.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +// This test should behave exactly like issue-2735-3 +struct defer<'a> { + b: &'a Cell<bool>, +} + +impl<'a> Drop for defer<'a> { + fn drop(&mut self) { + self.b.set(true); + } +} + +fn defer(b: &Cell<bool>) -> defer { + defer { + b: b + } +} + +pub fn main() { + let dtor_ran = &Cell::new(false); + let _ = defer(dtor_ran); + assert!(dtor_ran.get()); +} diff --git a/tests/ui/issues/issue-2735-3.rs b/tests/ui/issues/issue-2735-3.rs new file mode 100644 index 000000000..233015378 --- /dev/null +++ b/tests/ui/issues/issue-2735-3.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +// This test should behave exactly like issue-2735-2 +struct defer<'a> { + b: &'a Cell<bool>, +} + +impl<'a> Drop for defer<'a> { + fn drop(&mut self) { + self.b.set(true); + } +} + +fn defer(b: &Cell<bool>) -> defer { + defer { + b: b + } +} + +pub fn main() { + let dtor_ran = &Cell::new(false); + defer(dtor_ran); + assert!(dtor_ran.get()); +} diff --git a/tests/ui/issues/issue-2735.rs b/tests/ui/issues/issue-2735.rs new file mode 100644 index 000000000..20d3949a9 --- /dev/null +++ b/tests/ui/issues/issue-2735.rs @@ -0,0 +1,22 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +trait hax { + fn dummy(&self) { } +} +impl<A> hax for A { } + +fn perform_hax<T: 'static>(x: Box<T>) -> Box<dyn hax+'static> { + Box::new(x) as Box<dyn hax+'static> +} + +fn deadcode() { + perform_hax(Box::new("deadcode".to_string())); +} + +pub fn main() { + perform_hax(Box::new(42)); +} diff --git a/tests/ui/issues/issue-27401-dropflag-reinit.rs b/tests/ui/issues/issue-27401-dropflag-reinit.rs new file mode 100644 index 000000000..ab54af29b --- /dev/null +++ b/tests/ui/issues/issue-27401-dropflag-reinit.rs @@ -0,0 +1,26 @@ +// run-pass + +// Check that when a `let`-binding occurs in a loop, its associated +// drop-flag is reinitialized (to indicate "needs-drop" at the end of +// the owning variable's scope). + +struct A<'a>(&'a mut i32); + +impl<'a> Drop for A<'a> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut cnt = 0; + for i in 0..2 { + let a = A(&mut cnt); + if i == 1 { // Note that + break; // both this break + } // and also + drop(a); // this move of `a` + // are necessary to expose the bug + } + assert_eq!(cnt, 2); +} diff --git a/tests/ui/issues/issue-27433.fixed b/tests/ui/issues/issue-27433.fixed new file mode 100644 index 000000000..ce31f6bea --- /dev/null +++ b/tests/ui/issues/issue-27433.fixed @@ -0,0 +1,7 @@ +// run-rustfix +fn main() { + let foo = 42u32; + #[allow(unused_variables, non_snake_case)] + let FOO : u32 = foo; + //~^ ERROR attempt to use a non-constant value in a constant +} diff --git a/tests/ui/issues/issue-27433.rs b/tests/ui/issues/issue-27433.rs new file mode 100644 index 000000000..01411a51c --- /dev/null +++ b/tests/ui/issues/issue-27433.rs @@ -0,0 +1,7 @@ +// run-rustfix +fn main() { + let foo = 42u32; + #[allow(unused_variables, non_snake_case)] + const FOO : u32 = foo; + //~^ ERROR attempt to use a non-constant value in a constant +} diff --git a/tests/ui/issues/issue-27433.stderr b/tests/ui/issues/issue-27433.stderr new file mode 100644 index 000000000..da751a649 --- /dev/null +++ b/tests/ui/issues/issue-27433.stderr @@ -0,0 +1,11 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/issue-27433.rs:5:23 + | +LL | const FOO : u32 = foo; + | --------- ^^^ non-constant value + | | + | help: consider using `let` instead of `const`: `let FOO` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/issues/issue-2748-a.rs b/tests/ui/issues/issue-2748-a.rs new file mode 100644 index 000000000..cbb9bcc28 --- /dev/null +++ b/tests/ui/issues/issue-2748-a.rs @@ -0,0 +1,17 @@ +// build-pass +#![allow(dead_code)] +#![allow(non_snake_case)] + +// pretty-expanded FIXME #23616 + +struct CMap<'a> { + buf: &'a [u8], +} + +fn CMap(buf: &[u8]) -> CMap { + CMap { + buf: buf + } +} + +pub fn main() { } diff --git a/tests/ui/issues/issue-27583.rs b/tests/ui/issues/issue-27583.rs new file mode 100644 index 000000000..84c94c7c9 --- /dev/null +++ b/tests/ui/issues/issue-27583.rs @@ -0,0 +1,47 @@ +// check-pass +// Regression test for issue #27583. Unclear how useful this will be +// going forward, since the issue in question was EXTREMELY sensitive +// to compiler internals (like the precise numbering of nodes), but +// what the hey. + +#![allow(warnings)] + +use std::cell::Cell; +use std::marker::PhantomData; + +pub trait Delegate<'tcx> { } + +pub struct InferCtxt<'a, 'tcx: 'a> { + x: PhantomData<&'a Cell<&'tcx ()>> +} + +pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> { + x: &'t InferCtxt<'a, 'tcx>, +} + +pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> { + typer: &'t InferCtxt<'a, 'tcx>, + mc: MemCategorizationContext<'t, 'a, 'tcx>, + delegate: &'d mut (Delegate<'tcx>+'d), +} + +impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> { + pub fn new(delegate: &'d mut Delegate<'tcx>, + typer: &'t InferCtxt<'a, 'tcx>) + -> ExprUseVisitor<'d,'t,'a,'tcx> + { + ExprUseVisitor { + typer: typer, + mc: MemCategorizationContext::new(typer), + delegate: delegate, + } + } +} + +impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> { + pub fn new(typer: &'t InferCtxt<'a, 'tcx>) -> MemCategorizationContext<'t, 'a, 'tcx> { + MemCategorizationContext { x: typer } + } +} + +fn main() { } diff --git a/tests/ui/issues/issue-27592.rs b/tests/ui/issues/issue-27592.rs new file mode 100644 index 000000000..88f70f584 --- /dev/null +++ b/tests/ui/issues/issue-27592.rs @@ -0,0 +1,19 @@ +// Regression test for issue #27592. + +fn write<'a, F: ::std::ops::FnOnce()->::std::fmt::Arguments<'a> + 'a>(fcn: F) { + use std::fmt::Write; + let _ = match fcn() { a => write!(&mut Stream, "{}", a), }; +} + +struct Stream; +impl ::std::fmt::Write for Stream { + fn write_str(&mut self, _s: &str) -> ::std::fmt::Result { + Ok( () ) + } +} + +fn main() { + write(|| format_args!("{}", String::from("Hello world"))); + //~^ ERROR cannot return value referencing temporary value + //~| ERROR cannot return reference to temporary value +} diff --git a/tests/ui/issues/issue-27592.stderr b/tests/ui/issues/issue-27592.stderr new file mode 100644 index 000000000..1205a8b65 --- /dev/null +++ b/tests/ui/issues/issue-27592.stderr @@ -0,0 +1,22 @@ +error[E0515]: cannot return value referencing temporary value + --> $DIR/issue-27592.rs:16:14 + | +LL | write(|| format_args!("{}", String::from("Hello world"))); + | ^^^^^^^^^^^^^^^^^^^---------------------------^ + | | | + | | temporary value created here + | returns a value referencing data owned by the current function + | + = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0515]: cannot return reference to temporary value + --> $DIR/issue-27592.rs:16:14 + | +LL | write(|| format_args!("{}", String::from("Hello world"))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returns a reference to data owned by the current function + | + = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-2761.rs b/tests/ui/issues/issue-2761.rs new file mode 100644 index 000000000..3ba098abb --- /dev/null +++ b/tests/ui/issues/issue-2761.rs @@ -0,0 +1,7 @@ +// run-fail +// error-pattern:custom message +// ignore-emscripten no processes + +fn main() { + assert!(false, "custom message"); +} diff --git a/tests/ui/issues/issue-27639.rs b/tests/ui/issues/issue-27639.rs new file mode 100644 index 000000000..945fbad91 --- /dev/null +++ b/tests/ui/issues/issue-27639.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +fn main() { + const iter: i32 = 0; + + for i in 1..10 { + println!("{}", i); + } +} diff --git a/tests/ui/issues/issue-27697.rs b/tests/ui/issues/issue-27697.rs new file mode 100644 index 000000000..12af8a8e8 --- /dev/null +++ b/tests/ui/issues/issue-27697.rs @@ -0,0 +1,21 @@ +// check-pass + +use std::ops::Deref; + +trait MyTrait { + fn do_something(&self); + fn as_str(&self) -> &str; +} + +impl Deref for dyn MyTrait { + type Target = str; + fn deref(&self) -> &Self::Target { + self.as_str() + } +} + +fn trait_object_does_something(t: &dyn MyTrait) { + t.do_something() +} + +fn main() {} diff --git a/tests/ui/issues/issue-27815.rs b/tests/ui/issues/issue-27815.rs new file mode 100644 index 000000000..9e53014f4 --- /dev/null +++ b/tests/ui/issues/issue-27815.rs @@ -0,0 +1,12 @@ +mod A {} + +fn main() { + let u = A { x: 1 }; //~ ERROR expected struct, variant or union type, found module `A` + let v = u32 { x: 1 }; //~ ERROR expected struct, variant or union type, found builtin type `u32` + match () { + A { x: 1 } => {} + //~^ ERROR expected struct, variant or union type, found module `A` + u32 { x: 1 } => {} + //~^ ERROR expected struct, variant or union type, found builtin type `u32` + } +} diff --git a/tests/ui/issues/issue-27815.stderr b/tests/ui/issues/issue-27815.stderr new file mode 100644 index 000000000..43f78ccf6 --- /dev/null +++ b/tests/ui/issues/issue-27815.stderr @@ -0,0 +1,27 @@ +error[E0574]: expected struct, variant or union type, found module `A` + --> $DIR/issue-27815.rs:4:13 + | +LL | let u = A { x: 1 }; + | ^ not a struct, variant or union type + +error[E0574]: expected struct, variant or union type, found builtin type `u32` + --> $DIR/issue-27815.rs:5:13 + | +LL | let v = u32 { x: 1 }; + | ^^^ not a struct, variant or union type + +error[E0574]: expected struct, variant or union type, found module `A` + --> $DIR/issue-27815.rs:7:9 + | +LL | A { x: 1 } => {} + | ^ not a struct, variant or union type + +error[E0574]: expected struct, variant or union type, found builtin type `u32` + --> $DIR/issue-27815.rs:9:9 + | +LL | u32 { x: 1 } => {} + | ^^^ not a struct, variant or union type + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0574`. diff --git a/tests/ui/issues/issue-27842.rs b/tests/ui/issues/issue-27842.rs new file mode 100644 index 000000000..3bcfa1330 --- /dev/null +++ b/tests/ui/issues/issue-27842.rs @@ -0,0 +1,11 @@ +fn main() { + let tup = (0, 1, 2); + // the case where we show a suggestion + let _ = tup[0]; + //~^ ERROR cannot index into a value of type + + // the case where we show just a general hint + let i = 0_usize; + let _ = tup[i]; + //~^ ERROR cannot index into a value of type +} diff --git a/tests/ui/issues/issue-27842.stderr b/tests/ui/issues/issue-27842.stderr new file mode 100644 index 000000000..784666a63 --- /dev/null +++ b/tests/ui/issues/issue-27842.stderr @@ -0,0 +1,17 @@ +error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` + --> $DIR/issue-27842.rs:4:13 + | +LL | let _ = tup[0]; + | ^^^^^^ help: to access tuple elements, use: `tup.0` + +error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` + --> $DIR/issue-27842.rs:9:13 + | +LL | let _ = tup[i]; + | ^^^^^^ + | + = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0608`. diff --git a/tests/ui/issues/issue-27859.rs b/tests/ui/issues/issue-27859.rs new file mode 100644 index 000000000..233670681 --- /dev/null +++ b/tests/ui/issues/issue-27859.rs @@ -0,0 +1,20 @@ +// run-pass +// ignore-wasm32 issue 42629 + +#[inline(never)] +fn foo(a: f32, b: f32) -> f32 { + a % b +} + +#[inline(never)] +fn bar(a: f32, b: f32) -> f32 { + ((a as f64) % (b as f64)) as f32 +} + +fn main() { + let unknown_float = std::env::args().len(); + println!("{}", foo(4.0, unknown_float as f32)); + println!("{}", foo(5.0, (unknown_float as f32) + 1.0)); + println!("{}", bar(6.0, (unknown_float as f32) + 2.0)); + println!("{}", bar(7.0, (unknown_float as f32) + 3.0)); +} diff --git a/tests/ui/issues/issue-27889.rs b/tests/ui/issues/issue-27889.rs new file mode 100644 index 000000000..623416a5d --- /dev/null +++ b/tests/ui/issues/issue-27889.rs @@ -0,0 +1,23 @@ +// check-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] +// Test that a field can have the same name in different variants +// of an enum + +pub enum Foo { + X { foo: u32 }, + Y { foo: u32 } +} + +pub fn foo(mut x: Foo) { + let mut y = None; + let mut z = None; + if let Foo::X { ref foo } = x { + z = Some(foo); + } + if let Foo::Y { ref mut foo } = x { + y = Some(foo); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-27901.rs b/tests/ui/issues/issue-27901.rs new file mode 100644 index 000000000..ffd90b689 --- /dev/null +++ b/tests/ui/issues/issue-27901.rs @@ -0,0 +1,11 @@ +// run-pass +trait Stream { type Item; } +impl<'a> Stream for &'a str { type Item = u8; } +fn f<'s>(s: &'s str) -> (&'s str, <&'s str as Stream>::Item) { + (s, 42) +} + +fn main() { + let fx = f as for<'t> fn(&'t str) -> (&'t str, <&'t str as Stream>::Item); + assert_eq!(fx("hi"), ("hi", 42)); +} diff --git a/tests/ui/issues/issue-27942.rs b/tests/ui/issues/issue-27942.rs new file mode 100644 index 000000000..34b34de38 --- /dev/null +++ b/tests/ui/issues/issue-27942.rs @@ -0,0 +1,14 @@ +pub trait Resources<'a> {} + +pub trait Buffer<'a, R: Resources<'a>> { + + fn select(&self) -> BufferViewHandle<R>; + //~^ ERROR mismatched types + //~| lifetime mismatch + //~| ERROR mismatched types + //~| lifetime mismatch +} + +pub struct BufferViewHandle<'a, R: 'a+Resources<'a>>(&'a R); + +fn main() {} diff --git a/tests/ui/issues/issue-27942.stderr b/tests/ui/issues/issue-27942.stderr new file mode 100644 index 000000000..7ea9345a6 --- /dev/null +++ b/tests/ui/issues/issue-27942.stderr @@ -0,0 +1,41 @@ +error[E0308]: mismatched types + --> $DIR/issue-27942.rs:5:25 + | +LL | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected trait `Resources<'_>` + found trait `Resources<'a>` +note: the anonymous lifetime defined here... + --> $DIR/issue-27942.rs:5:15 + | +LL | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/issue-27942.rs:3:18 + | +LL | pub trait Buffer<'a, R: Resources<'a>> { + | ^^ + +error[E0308]: mismatched types + --> $DIR/issue-27942.rs:5:25 + | +LL | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected trait `Resources<'_>` + found trait `Resources<'a>` +note: the lifetime `'a` as defined here... + --> $DIR/issue-27942.rs:3:18 + | +LL | pub trait Buffer<'a, R: Resources<'a>> { + | ^^ +note: ...does not necessarily outlive the anonymous lifetime defined here + --> $DIR/issue-27942.rs:5:15 + | +LL | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-27949.rs b/tests/ui/issues/issue-27949.rs new file mode 100644 index 000000000..e905da72a --- /dev/null +++ b/tests/ui/issues/issue-27949.rs @@ -0,0 +1,41 @@ +// run-pass +// +// At one time, the `==` operator (and other binary operators) did not +// support subtyping during type checking, and would therefore require +// LHS and RHS to be exactly identical--i.e. to have the same lifetimes. +// +// This was fixed in 1a7fb7dc78439a704f024609ce3dc0beb1386552. + +#[derive(Copy, Clone)] +struct Input<'a> { + foo: &'a u32 +} + +impl <'a> std::cmp::PartialEq<Input<'a>> for Input<'a> { + fn eq(&self, other: &Input<'a>) -> bool { + self.foo == other.foo + } + + fn ne(&self, other: &Input<'a>) -> bool { + self.foo != other.foo + } +} + + +fn check_equal<'a, 'b>(x: Input<'a>, y: Input<'b>) -> bool { + // Type checking error due to 'a != 'b prior to 1a7fb7dc78 + x == y +} + +fn main() { + let i = 1u32; + let j = 1u32; + let k = 2u32; + + let input_i = Input { foo: &i }; + let input_j = Input { foo: &j }; + let input_k = Input { foo: &k }; + assert!(check_equal(input_i, input_i)); + assert!(check_equal(input_i, input_j)); + assert!(!check_equal(input_i, input_k)); +} diff --git a/tests/ui/issues/issue-27997.rs b/tests/ui/issues/issue-27997.rs new file mode 100644 index 000000000..dd74cf752 --- /dev/null +++ b/tests/ui/issues/issue-27997.rs @@ -0,0 +1,37 @@ +// run-pass +use std::sync::atomic::{Ordering, AtomicUsize}; + +use std::mem; +struct S<U,V> { + _u: U, + size_of_u: usize, + _v: V, + size_of_v: usize +} + +impl<U, V> S<U, V> { + fn new(u: U, v: V) -> Self { + S { + _u: u, + size_of_u: mem::size_of::<U>(), + _v: v, + size_of_v: mem::size_of::<V>() + } + } +} + +static COUNT: AtomicUsize = AtomicUsize::new(0); + +impl<V, U> Drop for S<U, V> { + fn drop(&mut self) { + assert_eq!(mem::size_of::<U>(), self.size_of_u); + assert_eq!(mem::size_of::<V>(), self.size_of_v); + COUNT.store(COUNT.load(Ordering::SeqCst)+1, Ordering::SeqCst); + } +} + +fn main() { + assert_eq!(COUNT.load(Ordering::SeqCst), 0); + { S::new(0u8, 1u16); } + assert_eq!(COUNT.load(Ordering::SeqCst), 1); +} diff --git a/tests/ui/issues/issue-2804-2.rs b/tests/ui/issues/issue-2804-2.rs new file mode 100644 index 000000000..d02725505 --- /dev/null +++ b/tests/ui/issues/issue-2804-2.rs @@ -0,0 +1,12 @@ +// check-pass +#![allow(dead_code)] +// Minimized version of issue-2804.rs. Both check that callee IDs don't +// clobber the previous node ID in a macro expr + +use std::collections::HashMap; + +fn add_interfaces(managed_ip: String, device: HashMap<String, isize>) { + println!("{}, {}", managed_ip, device["interfaces"]); +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-28105.rs b/tests/ui/issues/issue-28105.rs new file mode 100644 index 000000000..1e8d2d6cc --- /dev/null +++ b/tests/ui/issues/issue-28105.rs @@ -0,0 +1,8 @@ +// Make sure that a continue span actually contains the keyword. + +fn main() { + continue //~ ERROR `continue` outside of a loop + ; + break //~ ERROR `break` outside of a loop + ; +} diff --git a/tests/ui/issues/issue-28105.stderr b/tests/ui/issues/issue-28105.stderr new file mode 100644 index 000000000..f450256f3 --- /dev/null +++ b/tests/ui/issues/issue-28105.stderr @@ -0,0 +1,15 @@ +error[E0268]: `continue` outside of a loop + --> $DIR/issue-28105.rs:4:5 + | +LL | continue + | ^^^^^^^^ cannot `continue` outside of a loop + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-28105.rs:6:5 + | +LL | break + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-28109.rs b/tests/ui/issues/issue-28109.rs new file mode 100644 index 000000000..755a539b5 --- /dev/null +++ b/tests/ui/issues/issue-28109.rs @@ -0,0 +1,12 @@ +// Make sure that label for continue and break is spanned correctly + +fn main() { + loop { + continue + 'b //~ ERROR use of undeclared label + ; + break + 'c //~ ERROR use of undeclared label + ; + } +} diff --git a/tests/ui/issues/issue-28109.stderr b/tests/ui/issues/issue-28109.stderr new file mode 100644 index 000000000..0f918d3b6 --- /dev/null +++ b/tests/ui/issues/issue-28109.stderr @@ -0,0 +1,15 @@ +error[E0426]: use of undeclared label `'b` + --> $DIR/issue-28109.rs:6:9 + | +LL | 'b + | ^^ undeclared label `'b` + +error[E0426]: use of undeclared label `'c` + --> $DIR/issue-28109.rs:9:9 + | +LL | 'c + | ^^ undeclared label `'c` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0426`. diff --git a/tests/ui/issues/issue-28181.rs b/tests/ui/issues/issue-28181.rs new file mode 100644 index 000000000..c46e131c6 --- /dev/null +++ b/tests/ui/issues/issue-28181.rs @@ -0,0 +1,6 @@ +// run-pass +fn bar<F>(f: F) -> usize where F: Fn([usize; 1]) -> usize { f([2]) } + +fn main() { + bar(|u| { u[0] }); +} diff --git a/tests/ui/issues/issue-2823.rs b/tests/ui/issues/issue-2823.rs new file mode 100644 index 000000000..7b443b415 --- /dev/null +++ b/tests/ui/issues/issue-2823.rs @@ -0,0 +1,14 @@ +struct C { + x: isize, +} + +impl Drop for C { + fn drop(&mut self) { + println!("dropping: {}", self.x); + } +} + +fn main() { + let c = C{ x: 2}; + let _d = c.clone(); //~ ERROR no method named `clone` found +} diff --git a/tests/ui/issues/issue-2823.stderr b/tests/ui/issues/issue-2823.stderr new file mode 100644 index 000000000..b5a2b2f55 --- /dev/null +++ b/tests/ui/issues/issue-2823.stderr @@ -0,0 +1,16 @@ +error[E0599]: no method named `clone` found for struct `C` in the current scope + --> $DIR/issue-2823.rs:13:16 + | +LL | struct C { + | -------- method `clone` not found for this struct +... +LL | let _d = c.clone(); + | ^^^^^ method not found in `C` + | + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `clone`, perhaps you need to implement it: + candidate #1: `Clone` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-28279.rs b/tests/ui/issues/issue-28279.rs new file mode 100644 index 000000000..bab5df122 --- /dev/null +++ b/tests/ui/issues/issue-28279.rs @@ -0,0 +1,21 @@ +// check-pass +#![allow(dead_code)] +use std::rc::Rc; + +fn test1() -> Rc<dyn for<'a> Fn(&'a usize) + 'static> { + if let Some(_) = Some(1) { + loop{} + } else { + loop{} + } +} + +fn test2() -> *mut (dyn for<'a> Fn(&'a usize) + 'static) { + if let Some(_) = Some(1) { + loop{} + } else { + loop{} + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-28344.rs b/tests/ui/issues/issue-28344.rs new file mode 100644 index 000000000..1a6a7f46b --- /dev/null +++ b/tests/ui/issues/issue-28344.rs @@ -0,0 +1,15 @@ +use std::ops::BitXor; + +fn main() { + let x: u8 = BitXor::bitor(0 as u8, 0 as u8); + //~^ ERROR must be specified + //~| no function or associated item named + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + + let g = BitXor::bitor; + //~^ ERROR must be specified + //~| no function or associated item named + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition +} diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr new file mode 100644 index 000000000..f398a5da3 --- /dev/null +++ b/tests/ui/issues/issue-28344.stderr @@ -0,0 +1,61 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-28344.rs:4:17 + | +LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); + | ^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `#[warn(bare_trait_objects)]` on by default +help: use `dyn` + | +LL | let x: u8 = <dyn BitXor>::bitor(0 as u8, 0 as u8); + | ++++ + + +error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified + --> $DIR/issue-28344.rs:4:17 + | +LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); + | ^^^^^^ help: specify the associated type: `BitXor<Output = Type>` + +error[E0599]: no function or associated item named `bitor` found for trait object `dyn BitXor<_>` in the current scope + --> $DIR/issue-28344.rs:4:25 + | +LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); + | ^^^^^ + | | + | function or associated item not found in `dyn BitXor<_>` + | help: there is a method with a similar name: `bitxor` + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-28344.rs:10:13 + | +LL | let g = BitXor::bitor; + | ^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> +help: use `dyn` + | +LL | let g = <dyn BitXor>::bitor; + | ++++ + + +error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified + --> $DIR/issue-28344.rs:10:13 + | +LL | let g = BitXor::bitor; + | ^^^^^^ help: specify the associated type: `BitXor<Output = Type>` + +error[E0599]: no function or associated item named `bitor` found for trait object `dyn BitXor<_>` in the current scope + --> $DIR/issue-28344.rs:10:21 + | +LL | let g = BitXor::bitor; + | ^^^^^ + | | + | function or associated item not found in `dyn BitXor<_>` + | help: there is a method with a similar name: `bitxor` + +error: aborting due to 4 previous errors; 2 warnings emitted + +Some errors have detailed explanations: E0191, E0599. +For more information about an error, try `rustc --explain E0191`. diff --git a/tests/ui/issues/issue-28433.rs b/tests/ui/issues/issue-28433.rs new file mode 100644 index 000000000..8d05c32d5 --- /dev/null +++ b/tests/ui/issues/issue-28433.rs @@ -0,0 +1,12 @@ +enum Bird { + pub Duck, + //~^ ERROR unnecessary visibility qualifier + Goose, + pub(crate) Dove + //~^ ERROR unnecessary visibility qualifier +} + + +fn main() { + let y = Bird::Goose; +} diff --git a/tests/ui/issues/issue-28433.stderr b/tests/ui/issues/issue-28433.stderr new file mode 100644 index 000000000..9f5f63336 --- /dev/null +++ b/tests/ui/issues/issue-28433.stderr @@ -0,0 +1,15 @@ +error[E0449]: unnecessary visibility qualifier + --> $DIR/issue-28433.rs:2:5 + | +LL | pub Duck, + | ^^^ `pub` not permitted here because it's implied + +error[E0449]: unnecessary visibility qualifier + --> $DIR/issue-28433.rs:5:5 + | +LL | pub(crate) Dove + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0449`. diff --git a/tests/ui/issues/issue-28472.rs b/tests/ui/issues/issue-28472.rs new file mode 100644 index 000000000..6db1f9a5b --- /dev/null +++ b/tests/ui/issues/issue-28472.rs @@ -0,0 +1,14 @@ +// Check that the visibility modifier is included in the span of foreign items. + +extern "C" { + fn foo(); + + pub //~ ERROR the name `foo` is defined multiple times + fn foo(); + + pub //~ ERROR the name `foo` is defined multiple times + static mut foo: u32; +} + +fn main() { +} diff --git a/tests/ui/issues/issue-28472.stderr b/tests/ui/issues/issue-28472.stderr new file mode 100644 index 000000000..051ed25b6 --- /dev/null +++ b/tests/ui/issues/issue-28472.stderr @@ -0,0 +1,27 @@ +error[E0428]: the name `foo` is defined multiple times + --> $DIR/issue-28472.rs:6:3 + | +LL | fn foo(); + | --------- previous definition of the value `foo` here +LL | +LL | / pub +LL | | fn foo(); + | |___________^ `foo` redefined here + | + = note: `foo` must be defined only once in the value namespace of this module + +error[E0428]: the name `foo` is defined multiple times + --> $DIR/issue-28472.rs:9:3 + | +LL | fn foo(); + | --------- previous definition of the value `foo` here +... +LL | / pub +LL | | static mut foo: u32; + | |______________________^ `foo` redefined here + | + = note: `foo` must be defined only once in the value namespace of this module + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-2848.rs b/tests/ui/issues/issue-2848.rs new file mode 100644 index 000000000..e0049bf8f --- /dev/null +++ b/tests/ui/issues/issue-2848.rs @@ -0,0 +1,17 @@ +#[allow(non_camel_case_types)] + +mod bar { + pub enum foo { + alpha, + beta, + charlie + } +} + +fn main() { + use bar::foo::{alpha, charlie}; + match alpha { + alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns + charlie => {} + } +} diff --git a/tests/ui/issues/issue-2848.stderr b/tests/ui/issues/issue-2848.stderr new file mode 100644 index 000000000..71ed7d70b --- /dev/null +++ b/tests/ui/issues/issue-2848.stderr @@ -0,0 +1,11 @@ +error[E0408]: variable `beta` is not bound in all patterns + --> $DIR/issue-2848.rs:14:7 + | +LL | alpha | beta => {} + | ^^^^^ ---- variable not in all patterns + | | + | pattern doesn't bind `beta` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0408`. diff --git a/tests/ui/issues/issue-2849.rs b/tests/ui/issues/issue-2849.rs new file mode 100644 index 000000000..787ab0e28 --- /dev/null +++ b/tests/ui/issues/issue-2849.rs @@ -0,0 +1,8 @@ +enum Foo { Alpha, Beta(isize) } + +fn main() { + match Foo::Alpha { + Foo::Alpha | Foo::Beta(i) => {} + //~^ ERROR variable `i` is not bound in all patterns + } +} diff --git a/tests/ui/issues/issue-2849.stderr b/tests/ui/issues/issue-2849.stderr new file mode 100644 index 000000000..9027098d2 --- /dev/null +++ b/tests/ui/issues/issue-2849.stderr @@ -0,0 +1,11 @@ +error[E0408]: variable `i` is not bound in all patterns + --> $DIR/issue-2849.rs:5:7 + | +LL | Foo::Alpha | Foo::Beta(i) => {} + | ^^^^^^^^^^ - variable not in all patterns + | | + | pattern doesn't bind `i` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0408`. diff --git a/tests/ui/issues/issue-28498-must-work-ex1.rs b/tests/ui/issues/issue-28498-must-work-ex1.rs new file mode 100644 index 000000000..ab6d190e0 --- /dev/null +++ b/tests/ui/issues/issue-28498-must-work-ex1.rs @@ -0,0 +1,18 @@ +// run-pass +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #examples-of-code-that-must-continue-to-work + +use std::cell::Cell; + +struct Concrete<'a>(#[allow(unused_tuple_struct_fields)] u32, Cell<Option<&'a Concrete<'a>>>); + +fn main() { + let mut data = Vec::new(); + data.push(Concrete(0, Cell::new(None))); + data.push(Concrete(0, Cell::new(None))); + + data[0].1.set(Some(&data[1])); + data[1].1.set(Some(&data[0])); +} diff --git a/tests/ui/issues/issue-28498-must-work-ex2.rs b/tests/ui/issues/issue-28498-must-work-ex2.rs new file mode 100644 index 000000000..378d736ee --- /dev/null +++ b/tests/ui/issues/issue-28498-must-work-ex2.rs @@ -0,0 +1,20 @@ +// run-pass +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #examples-of-code-that-must-continue-to-work + +use std::cell::Cell; + +struct Concrete<'a>(#[allow(unused_tuple_struct_fields)] u32, Cell<Option<&'a Concrete<'a>>>); + +struct Foo<T> { data: Vec<T> } + +fn main() { + let mut foo = Foo { data: Vec::new() }; + foo.data.push(Concrete(0, Cell::new(None))); + foo.data.push(Concrete(0, Cell::new(None))); + + foo.data[0].1.set(Some(&foo.data[1])); + foo.data[1].1.set(Some(&foo.data[0])); +} diff --git a/tests/ui/issues/issue-28498-ugeh-ex1.rs b/tests/ui/issues/issue-28498-ugeh-ex1.rs new file mode 100644 index 000000000..24bf706ce --- /dev/null +++ b/tests/ui/issues/issue-28498-ugeh-ex1.rs @@ -0,0 +1,27 @@ +// run-pass + +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #example-of-the-unguarded-escape-hatch + +#![feature(dropck_eyepatch)] +use std::cell::Cell; + +struct Concrete<'a>(#[allow(unused_tuple_struct_fields)] u32, Cell<Option<&'a Concrete<'a>>>); + +struct Foo<T> { data: Vec<T> } + +// Below is the UGEH attribute +unsafe impl<#[may_dangle] T> Drop for Foo<T> { + fn drop(&mut self) { } +} + +fn main() { + let mut foo = Foo { data: Vec::new() }; + foo.data.push(Concrete(0, Cell::new(None))); + foo.data.push(Concrete(0, Cell::new(None))); + + foo.data[0].1.set(Some(&foo.data[1])); + foo.data[1].1.set(Some(&foo.data[0])); +} diff --git a/tests/ui/issues/issue-28550.rs b/tests/ui/issues/issue-28550.rs new file mode 100644 index 000000000..95583f805 --- /dev/null +++ b/tests/ui/issues/issue-28550.rs @@ -0,0 +1,16 @@ +// run-pass +struct A<F: FnOnce()->T,T>(F::Output); +struct B<F: FnOnce()->T,T>(A<F,T>); + +// Removing Option causes it to compile. +fn foo<T,F: FnOnce()->T>(f: F) -> Option<B<F,T>> { + Some(B(A(f()))) +} + +fn main() { + let v = (|| foo(||4))(); + match v { + Some(B(A(4))) => {}, + _ => unreachable!() + } +} diff --git a/tests/ui/issues/issue-28561.rs b/tests/ui/issues/issue-28561.rs new file mode 100644 index 000000000..beb12c36d --- /dev/null +++ b/tests/ui/issues/issue-28561.rs @@ -0,0 +1,73 @@ +// check-pass +#[derive(Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Clone, Copy)] +struct Array<T> { + f00: [T; 00], + f01: [T; 01], + f02: [T; 02], + f03: [T; 03], + f04: [T; 04], + f05: [T; 05], + f06: [T; 06], + f07: [T; 07], + f08: [T; 08], + f09: [T; 09], + f10: [T; 10], + f11: [T; 11], + f12: [T; 12], + f13: [T; 13], + f14: [T; 14], + f15: [T; 15], + f16: [T; 16], + f17: [T; 17], + f18: [T; 18], + f19: [T; 19], + f20: [T; 20], + f21: [T; 21], + f22: [T; 22], + f23: [T; 23], + f24: [T; 24], + f25: [T; 25], + f26: [T; 26], + f27: [T; 27], + f28: [T; 28], + f29: [T; 29], + f30: [T; 30], + f31: [T; 31], + f32: [T; 32], +} + +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +struct Fn<A, B, C, D, E, F, G, H, I, J, K, L> { + f00: fn(), + f01: fn(A), + f02: fn(A, B), + f03: fn(A, B, C), + f04: fn(A, B, C, D), + f05: fn(A, B, C, D, E), + f06: fn(A, B, C, D, E, F), + f07: fn(A, B, C, D, E, F, G), + f08: fn(A, B, C, D, E, F, G, H), + f09: fn(A, B, C, D, E, F, G, H, I), + f10: fn(A, B, C, D, E, F, G, H, I, J), + f11: fn(A, B, C, D, E, F, G, H, I, J, K), + f12: fn(A, B, C, D, E, F, G, H, I, J, K, L), +} + +#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +struct Tuple<A, B, C, D, E, F, G, H, I, J, K, L> { + f00: (), + f01: (A), + f02: (A, B), + f03: (A, B, C), + f04: (A, B, C, D), + f05: (A, B, C, D, E), + f06: (A, B, C, D, E, F), + f07: (A, B, C, D, E, F, G), + f08: (A, B, C, D, E, F, G, H), + f09: (A, B, C, D, E, F, G, H, I), + f10: (A, B, C, D, E, F, G, H, I, J), + f11: (A, B, C, D, E, F, G, H, I, J, K), + f12: (A, B, C, D, E, F, G, H, I, J, K, L), +} + +fn main() {} diff --git a/tests/ui/issues/issue-28568.rs b/tests/ui/issues/issue-28568.rs new file mode 100644 index 000000000..ce511158f --- /dev/null +++ b/tests/ui/issues/issue-28568.rs @@ -0,0 +1,12 @@ +struct MyStruct; + +impl Drop for MyStruct { + fn drop(&mut self) { } +} + +impl Drop for MyStruct { +//~^ ERROR conflicting implementations of trait + fn drop(&mut self) { } +} + +fn main() {} diff --git a/tests/ui/issues/issue-28568.stderr b/tests/ui/issues/issue-28568.stderr new file mode 100644 index 000000000..960259080 --- /dev/null +++ b/tests/ui/issues/issue-28568.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Drop` for type `MyStruct` + --> $DIR/issue-28568.rs:7:1 + | +LL | impl Drop for MyStruct { + | ---------------------- first implementation here +... +LL | impl Drop for MyStruct { + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyStruct` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/issues/issue-28586.rs b/tests/ui/issues/issue-28586.rs new file mode 100644 index 000000000..c543ef9b0 --- /dev/null +++ b/tests/ui/issues/issue-28586.rs @@ -0,0 +1,7 @@ +// Regression test for issue #28586 + +pub trait Foo {} +impl Foo for [u8; usize::BYTES] {} +//~^ ERROR no associated item named `BYTES` found + +fn main() { } diff --git a/tests/ui/issues/issue-28586.stderr b/tests/ui/issues/issue-28586.stderr new file mode 100644 index 000000000..d19c4af2d --- /dev/null +++ b/tests/ui/issues/issue-28586.stderr @@ -0,0 +1,9 @@ +error[E0599]: no associated item named `BYTES` found for type `usize` in the current scope + --> $DIR/issue-28586.rs:4:26 + | +LL | impl Foo for [u8; usize::BYTES] {} + | ^^^^^ associated item not found in `usize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-28600.rs b/tests/ui/issues/issue-28600.rs new file mode 100644 index 000000000..52db0d5fd --- /dev/null +++ b/tests/ui/issues/issue-28600.rs @@ -0,0 +1,15 @@ +// build-pass +// #28600 ICE: pub extern fn with parameter type &str inside struct impl + +struct Test; + +impl Test { + #[allow(dead_code)] + #[allow(unused_variables)] + #[allow(improper_ctypes_definitions)] + pub extern "C" fn test(val: &str) { + + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-28625.rs b/tests/ui/issues/issue-28625.rs new file mode 100644 index 000000000..15a6a63d5 --- /dev/null +++ b/tests/ui/issues/issue-28625.rs @@ -0,0 +1,22 @@ +// normalize-stderr-test "\d+ bits" -> "N bits" + +trait Bar { + type Bar; +} + +struct ArrayPeano<T: Bar> { + data: T::Bar, +} + +fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar { + unsafe { std::mem::transmute(a) } //~ ERROR cannot transmute between types of different sizes +} + +impl Bar for () { + type Bar = (); +} + +fn main() { + let x: ArrayPeano<()> = ArrayPeano { data: () }; + foo(&x); +} diff --git a/tests/ui/issues/issue-28625.stderr b/tests/ui/issues/issue-28625.stderr new file mode 100644 index 000000000..7ee0cd486 --- /dev/null +++ b/tests/ui/issues/issue-28625.stderr @@ -0,0 +1,12 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-28625.rs:12:14 + | +LL | unsafe { std::mem::transmute(a) } + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `&ArrayPeano<T>` (N bits) + = note: target type: `&[T]` (N bits) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/issues/issue-28776.mir.stderr b/tests/ui/issues/issue-28776.mir.stderr new file mode 100644 index 000000000..1d470fb5e --- /dev/null +++ b/tests/ui/issues/issue-28776.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-28776.rs:7:5 + | +LL | (&ptr::write)(1 as *mut _, 42); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-28776.rs b/tests/ui/issues/issue-28776.rs new file mode 100644 index 000000000..19df3c4a4 --- /dev/null +++ b/tests/ui/issues/issue-28776.rs @@ -0,0 +1,9 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +use std::ptr; + +fn main() { + (&ptr::write)(1 as *mut _, 42); + //~^ ERROR E0133 +} diff --git a/tests/ui/issues/issue-28776.thir.stderr b/tests/ui/issues/issue-28776.thir.stderr new file mode 100644 index 000000000..e3562810b --- /dev/null +++ b/tests/ui/issues/issue-28776.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function `std::ptr::write` is unsafe and requires unsafe function or block + --> $DIR/issue-28776.rs:7:5 + | +LL | (&ptr::write)(1 as *mut _, 42); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-28777.rs b/tests/ui/issues/issue-28777.rs new file mode 100644 index 000000000..1f426b718 --- /dev/null +++ b/tests/ui/issues/issue-28777.rs @@ -0,0 +1,22 @@ +// run-pass +#![allow(unused_braces)] +fn main() { + let v1 = { 1 + {2} * {3} }; + let v2 = 1 + {2} * {3} ; + + assert_eq!(7, v1); + assert_eq!(7, v2); + + let v3; + v3 = { 1 + {2} * {3} }; + let v4; + v4 = 1 + {2} * {3}; + assert_eq!(7, v3); + assert_eq!(7, v4); + + let v5 = { 1 + {2} * 3 }; + assert_eq!(7, v5); + + let v9 = { 1 + if 1 > 2 {1} else {2} * {3} }; + assert_eq!(7, v9); +} diff --git a/tests/ui/issues/issue-28822.rs b/tests/ui/issues/issue-28822.rs new file mode 100644 index 000000000..10e5d1dd0 --- /dev/null +++ b/tests/ui/issues/issue-28822.rs @@ -0,0 +1,7 @@ +// check-pass +#![allow(dead_code)] + +fn main() {} + +const fn size_ofs(_: usize) {} +const fn size_ofs2(_foo: usize) {} diff --git a/tests/ui/issues/issue-28828.rs b/tests/ui/issues/issue-28828.rs new file mode 100644 index 000000000..03968809e --- /dev/null +++ b/tests/ui/issues/issue-28828.rs @@ -0,0 +1,18 @@ +// run-pass +pub trait Foo { + type Out; +} + +impl Foo for () { + type Out = bool; +} + +fn main() { + type Bool = <() as Foo>::Out; + + let x: Bool = true; + assert!(x); + + let y: Option<Bool> = None; + assert_eq!(y, None); +} diff --git a/tests/ui/issues/issue-28839.rs b/tests/ui/issues/issue-28839.rs new file mode 100644 index 000000000..73be87a0c --- /dev/null +++ b/tests/ui/issues/issue-28839.rs @@ -0,0 +1,15 @@ +// run-pass +// ignore-pretty issue #37199 + +pub struct Foo; + +pub fn get_foo2<'a>(foo: &'a mut Option<&'a mut Foo>) -> &'a mut Foo { + match foo { + // Ensure that this is not considered a move, but rather a reborrow. + &mut Some(ref mut x) => *x, + &mut None => panic!(), + } +} + +fn main() { +} diff --git a/tests/ui/issues/issue-28936.rs b/tests/ui/issues/issue-28936.rs new file mode 100644 index 000000000..da9e92c0c --- /dev/null +++ b/tests/ui/issues/issue-28936.rs @@ -0,0 +1,27 @@ +// check-pass +pub type Session = i32; +pub struct StreamParser<'a, T> { + _tokens: T, + _session: &'a mut Session, +} + +impl<'a, T> StreamParser<'a, T> { + pub fn thing(&mut self) -> bool { true } +} + +pub fn parse_stream<T: Iterator<Item=i32>, U, F>( + _session: &mut Session, _tokens: T, _f: F) -> U + where F: Fn(&mut StreamParser<T>) -> U { panic!(); } + +pub fn thing(session: &mut Session) { + let mut stream = vec![1, 2, 3].into_iter(); + + let _b = parse_stream(session, + stream.by_ref(), + // replacing the above with the following fixes it + //&mut stream, + |p| p.thing()); + +} + +fn main() {} diff --git a/tests/ui/issues/issue-2895.rs b/tests/ui/issues/issue-2895.rs new file mode 100644 index 000000000..d8c08996b --- /dev/null +++ b/tests/ui/issues/issue-2895.rs @@ -0,0 +1,28 @@ +// run-pass +#![allow(dead_code)] + +use std::mem; + +struct Cat { + x: isize +} + +struct Kitty { + x: isize, +} + +impl Drop for Kitty { + fn drop(&mut self) {} +} + +#[cfg(target_pointer_width = "64")] +pub fn main() { + assert_eq!(mem::size_of::<Cat>(), 8 as usize); + assert_eq!(mem::size_of::<Kitty>(), 8 as usize); +} + +#[cfg(target_pointer_width = "32")] +pub fn main() { + assert_eq!(mem::size_of::<Cat>(), 4 as usize); + assert_eq!(mem::size_of::<Kitty>(), 4 as usize); +} diff --git a/tests/ui/issues/issue-28971.rs b/tests/ui/issues/issue-28971.rs new file mode 100644 index 000000000..f0a1e2d00 --- /dev/null +++ b/tests/ui/issues/issue-28971.rs @@ -0,0 +1,16 @@ +enum Foo { + Bar(u8) +} +fn main(){ + foo(|| { + match Foo::Bar(1) { + Foo::Baz(..) => (), + //~^ ERROR no variant or associated item named `Baz` found + _ => (), + } + }); +} + +fn foo<F>(f: F) where F: FnMut() { + f(); +} diff --git a/tests/ui/issues/issue-28971.stderr b/tests/ui/issues/issue-28971.stderr new file mode 100644 index 000000000..2eb8a1c26 --- /dev/null +++ b/tests/ui/issues/issue-28971.stderr @@ -0,0 +1,15 @@ +error[E0599]: no variant or associated item named `Baz` found for enum `Foo` in the current scope + --> $DIR/issue-28971.rs:7:18 + | +LL | enum Foo { + | -------- variant or associated item `Baz` not found for this enum +... +LL | Foo::Baz(..) => (), + | ^^^ + | | + | variant or associated item not found in `Foo` + | help: there is a variant with a similar name: `Bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-28983.rs b/tests/ui/issues/issue-28983.rs new file mode 100644 index 000000000..3db26a1ee --- /dev/null +++ b/tests/ui/issues/issue-28983.rs @@ -0,0 +1,22 @@ +// run-pass +pub trait Test { type T; } + +impl Test for u32 { + type T = i32; +} + +pub mod export { + #[no_mangle] + pub extern "C" fn issue_28983(t: <u32 as ::Test>::T) -> i32 { t*3 } +} + +// to test both exporting and importing functions, import +// a function from ourselves. +extern "C" { + fn issue_28983(t: <u32 as Test>::T) -> i32; +} + +fn main() { + assert_eq!(export::issue_28983(2), 6); + assert_eq!(unsafe { issue_28983(3) }, 9); +} diff --git a/tests/ui/issues/issue-28992-empty.rs b/tests/ui/issues/issue-28992-empty.rs new file mode 100644 index 000000000..74cfeb6db --- /dev/null +++ b/tests/ui/issues/issue-28992-empty.rs @@ -0,0 +1,16 @@ +// Can't use constants as tuple struct patterns + + +const C1: i32 = 0; + +struct S; + +impl S { + const C2: i32 = 0; +} + +fn main() { + if let C1(..) = 0 {} //~ ERROR expected tuple struct or tuple variant, found constant `C1` + if let S::C2(..) = 0 {} + //~^ ERROR expected tuple struct or tuple variant, found associated constant `S::C2` +} diff --git a/tests/ui/issues/issue-28992-empty.stderr b/tests/ui/issues/issue-28992-empty.stderr new file mode 100644 index 000000000..f69773b8c --- /dev/null +++ b/tests/ui/issues/issue-28992-empty.stderr @@ -0,0 +1,16 @@ +error[E0532]: expected tuple struct or tuple variant, found constant `C1` + --> $DIR/issue-28992-empty.rs:13:12 + | +LL | if let C1(..) = 0 {} + | ^^ not a tuple struct or tuple variant + +error[E0164]: expected tuple struct or tuple variant, found associated constant `S::C2` + --> $DIR/issue-28992-empty.rs:14:12 + | +LL | if let S::C2(..) = 0 {} + | ^^^^^^^^^ not a tuple struct or tuple variant + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0164, E0532. +For more information about an error, try `rustc --explain E0164`. diff --git a/tests/ui/issues/issue-28999.rs b/tests/ui/issues/issue-28999.rs new file mode 100644 index 000000000..cec3e25da --- /dev/null +++ b/tests/ui/issues/issue-28999.rs @@ -0,0 +1,11 @@ +// check-pass +pub struct Xyz<'a, V> { + pub v: (V, &'a u32), +} + +pub fn eq<'a, 's, 't, V>(this: &'s Xyz<'a, V>, other: &'t Xyz<'a, V>) -> bool + where V: PartialEq { + this.v == other.v +} + +fn main() {} diff --git a/tests/ui/issues/issue-29030.rs b/tests/ui/issues/issue-29030.rs new file mode 100644 index 000000000..723e35840 --- /dev/null +++ b/tests/ui/issues/issue-29030.rs @@ -0,0 +1,9 @@ +// check-pass +#![allow(dead_code)] +#[derive(Debug)] +struct Message<'a, P: 'a = &'a [u8]> { + header: &'a [u8], + payload: P, +} + +fn main() {} diff --git a/tests/ui/issues/issue-29037.rs b/tests/ui/issues/issue-29037.rs new file mode 100644 index 000000000..155ed144b --- /dev/null +++ b/tests/ui/issues/issue-29037.rs @@ -0,0 +1,24 @@ +// check-pass +#![allow(dead_code)] +// This test ensures that each pointer type `P<X>` is covariant in `X`. + +use std::rc::Rc; +use std::sync::Arc; + +fn a<'r>(x: Box<&'static str>) -> Box<&'r str> { + x +} + +fn b<'r, 'w>(x: &'w &'static str) -> &'w &'r str { + x +} + +fn c<'r>(x: Arc<&'static str>) -> Arc<&'r str> { + x +} + +fn d<'r>(x: Rc<&'static str>) -> Rc<&'r str> { + x +} + +fn main() {} diff --git a/tests/ui/issues/issue-2904.rs b/tests/ui/issues/issue-2904.rs new file mode 100644 index 000000000..73aa78f09 --- /dev/null +++ b/tests/ui/issues/issue-2904.rs @@ -0,0 +1,79 @@ +// build-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(non_camel_case_types)] + +// Map representation + +use std::fmt; +use std::io::prelude::*; +use square::{bot, wall, rock, lambda, closed_lift, open_lift, earth, empty}; + +enum square { + bot, + wall, + rock, + lambda, + closed_lift, + open_lift, + earth, + empty +} + +impl fmt::Debug for square { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", match *self { + bot => { "R".to_string() } + wall => { "#".to_string() } + rock => { "*".to_string() } + lambda => { "\\".to_string() } + closed_lift => { "L".to_string() } + open_lift => { "O".to_string() } + earth => { ".".to_string() } + empty => { " ".to_string() } + }) + } +} + +fn square_from_char(c: char) -> square { + match c { + 'R' => { bot } + '#' => { wall } + '*' => { rock } + '\\' => { lambda } + 'L' => { closed_lift } + 'O' => { open_lift } + '.' => { earth } + ' ' => { empty } + _ => { + println!("invalid square: {}", c); + panic!() + } + } +} + +fn read_board_grid<rdr:'static + Read>(mut input: rdr) + -> Vec<Vec<square>> { + let mut input: &mut dyn Read = &mut input; + let mut grid = Vec::new(); + let mut line = [0; 10]; + input.read(&mut line); + let mut row = Vec::new(); + for c in &line { + row.push(square_from_char(*c as char)) + } + grid.push(row); + let width = grid[0].len(); + for row in &grid { assert_eq!(row.len(), width) } + grid +} + +mod test { + #[test] + pub fn trivial_to_string() { + assert_eq!(lambda.to_string(), "\\") + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-29048.rs b/tests/ui/issues/issue-29048.rs new file mode 100644 index 000000000..039f072f1 --- /dev/null +++ b/tests/ui/issues/issue-29048.rs @@ -0,0 +1,12 @@ +// check-pass +pub struct Chan; +pub struct ChanSelect<'c, T> { + chans: Vec<(&'c Chan, T)>, +} +impl<'c, T> ChanSelect<'c, T> { + pub fn add_recv_ret(&mut self, chan: &'c Chan, ret: T) + { + self.chans.push((chan, ret)); + } +} +fn main() {} diff --git a/tests/ui/issues/issue-29053.rs b/tests/ui/issues/issue-29053.rs new file mode 100644 index 000000000..34c4a0f8f --- /dev/null +++ b/tests/ui/issues/issue-29053.rs @@ -0,0 +1,12 @@ +// run-pass +fn main() { + let x: &'static str = "x"; + + { + let y = "y".to_string(); + let ref mut x = &*x; + *x = &*y; + } + + assert_eq!(x, "x"); +} diff --git a/tests/ui/issues/issue-29071-2.rs b/tests/ui/issues/issue-29071-2.rs new file mode 100644 index 000000000..f27bf0261 --- /dev/null +++ b/tests/ui/issues/issue-29071-2.rs @@ -0,0 +1,32 @@ +// run-pass +#![allow(dead_code)] +fn t1() -> u32 { + let x; + x = if true { [1, 2, 3] } else { [2, 3, 4] }[0]; + x +} + +fn t2() -> [u32; 1] { + if true { [1, 2, 3]; } else { [2, 3, 4]; } + [0] +} + +fn t3() -> u32 { + let x; + x = if true { i1 as F } else { i2 as F }(); + x +} + +fn t4() -> () { + if true { i1 as F; } else { i2 as F; } + () +} + +type F = fn() -> u32; +fn i1() -> u32 { 1 } +fn i2() -> u32 { 2 } + +fn main() { + assert_eq!(t1(), 1); + assert_eq!(t3(), 1); +} diff --git a/tests/ui/issues/issue-29071.rs b/tests/ui/issues/issue-29071.rs new file mode 100644 index 000000000..8bdacf2ce --- /dev/null +++ b/tests/ui/issues/issue-29071.rs @@ -0,0 +1,16 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +fn ret() -> u32 { + static x: u32 = 10; + x & if true { 10u32 } else { 20u32 } & x +} + +fn ret2() -> &'static u32 { + static x: u32 = 10; + if true { 10u32; } else { 20u32; } + &x +} + +fn main() {} diff --git a/tests/ui/issues/issue-29092.rs b/tests/ui/issues/issue-29092.rs new file mode 100644 index 000000000..f20d2a424 --- /dev/null +++ b/tests/ui/issues/issue-29092.rs @@ -0,0 +1,26 @@ +// run-pass +// Regression test for Issue #29092. +// +// (Possibly redundant with regression test run-pass/issue-30530.rs) + +use self::Term::*; + +#[derive(Clone)] +pub enum Term { + Dummy, + A(Box<Term>), + B(Box<Term>), +} + +// a small-step evaluator +pub fn small_eval(v: Term) -> Term { + match v { + A(t) => *t.clone(), + B(t) => *t.clone(), + _ => Dummy, + } +} + +fn main() { + small_eval(Dummy); +} diff --git a/tests/ui/issues/issue-29147-rpass.rs b/tests/ui/issues/issue-29147-rpass.rs new file mode 100644 index 000000000..439f8bb53 --- /dev/null +++ b/tests/ui/issues/issue-29147-rpass.rs @@ -0,0 +1,28 @@ +// run-pass +#![recursion_limit="1024"] +#![allow(dead_code)] + +use std::mem; + +pub struct S0<T>(T,T); +pub struct S1<T>(Option<Box<S0<S0<T>>>>,Option<Box<S0<S0<T>>>>); +pub struct S2<T>(Option<Box<S1<S1<T>>>>,Option<Box<S1<S1<T>>>>); +pub struct S3<T>(Option<Box<S2<S2<T>>>>,Option<Box<S2<S2<T>>>>); +pub struct S4<T>(Option<Box<S3<S3<T>>>>,Option<Box<S3<S3<T>>>>); +pub struct S5<T>(Option<Box<S4<S4<T>>>>,Option<Box<S4<S4<T>>>>,Option<T>); + +trait Foo { fn xxx(&self); } +/// some local of #[fundamental] trait +trait Bar {} + +impl<T> Foo for T where T: Bar, T: Sync { + fn xxx(&self) {} +} + +impl Foo for S5<u8> { fn xxx(&self) {} } + +fn main() { + let s = S5(None,None,None); + s.xxx(); + assert_eq!(mem::size_of_val(&s.2), mem::size_of::<Option<u8>>()); +} diff --git a/tests/ui/issues/issue-29147.rs b/tests/ui/issues/issue-29147.rs new file mode 100644 index 000000000..190ecf460 --- /dev/null +++ b/tests/ui/issues/issue-29147.rs @@ -0,0 +1,23 @@ +#![recursion_limit="1024"] +#![allow(dead_code)] + +pub struct S0<T>(T,T); +pub struct S1<T>(Option<Box<S0<S0<T>>>>,Option<Box<S0<S0<T>>>>); +pub struct S2<T>(Option<Box<S1<S1<T>>>>,Option<Box<S1<S1<T>>>>); +pub struct S3<T>(Option<Box<S2<S2<T>>>>,Option<Box<S2<S2<T>>>>); +pub struct S4<T>(Option<Box<S3<S3<T>>>>,Option<Box<S3<S3<T>>>>); +pub struct S5<T>(Option<Box<S4<S4<T>>>>,Option<Box<S4<S4<T>>>>,Option<T>); + +trait Foo { fn xxx(&self); } +trait Bar {} // anything local or #[fundamental] + +impl<T> Foo for T where T: Bar, T: Sync { + fn xxx(&self) {} +} + +impl Foo for S5<u32> { fn xxx(&self) {} } +impl Foo for S5<u64> { fn xxx(&self) {} } + +fn main() { + let _ = <S5<_>>::xxx; //~ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-29147.stderr b/tests/ui/issues/issue-29147.stderr new file mode 100644 index 000000000..138d477dc --- /dev/null +++ b/tests/ui/issues/issue-29147.stderr @@ -0,0 +1,17 @@ +error[E0283]: type annotations needed + --> $DIR/issue-29147.rs:22:13 + | +LL | let _ = <S5<_>>::xxx; + | ^^^^^^^^^^^^ cannot infer type for struct `S5<_>` + | +note: multiple `impl`s satisfying `S5<_>: Foo` found + --> $DIR/issue-29147.rs:18:1 + | +LL | impl Foo for S5<u32> { fn xxx(&self) {} } + | ^^^^^^^^^^^^^^^^^^^^ +LL | impl Foo for S5<u64> { fn xxx(&self) {} } + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/issues/issue-29181.rs b/tests/ui/issues/issue-29181.rs new file mode 100644 index 000000000..70e5bc019 --- /dev/null +++ b/tests/ui/issues/issue-29181.rs @@ -0,0 +1,9 @@ +// aux-build:issue-29181.rs + +extern crate issue_29181 as foo; + +fn main() { + 0.homura(); //~ ERROR no method named `homura` found + // Issue #47759, detect existing method on the fundamental impl: + let _ = |x: f64| x * 2.0.exp(); //~ ERROR can't call method `exp` on ambiguous numeric type +} diff --git a/tests/ui/issues/issue-29181.stderr b/tests/ui/issues/issue-29181.stderr new file mode 100644 index 000000000..53addf2fe --- /dev/null +++ b/tests/ui/issues/issue-29181.stderr @@ -0,0 +1,21 @@ +error[E0599]: no method named `homura` found for type `{integer}` in the current scope + --> $DIR/issue-29181.rs:6:7 + | +LL | 0.homura(); + | ^^^^^^ method not found in `{integer}` + +error[E0689]: can't call method `exp` on ambiguous numeric type `{float}` + --> $DIR/issue-29181.rs:8:30 + | +LL | let _ = |x: f64| x * 2.0.exp(); + | ^^^ + | +help: you must specify a concrete type for this numeric value, like `f32` + | +LL | let _ = |x: f64| x * 2.0_f32.exp(); + | ~~~~~~~ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0599, E0689. +For more information about an error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-29265.rs b/tests/ui/issues/issue-29265.rs new file mode 100644 index 000000000..f554c4d16 --- /dev/null +++ b/tests/ui/issues/issue-29265.rs @@ -0,0 +1,10 @@ +// aux-build:issue-29265.rs +// check-pass + +extern crate issue_29265 as lib; + +static _UNUSED: &'static lib::SomeType = &lib::SOME_VALUE; + +fn main() { + vec![0u8; lib::SOME_VALUE.some_member]; +} diff --git a/tests/ui/issues/issue-29276.rs b/tests/ui/issues/issue-29276.rs new file mode 100644 index 000000000..02b695659 --- /dev/null +++ b/tests/ui/issues/issue-29276.rs @@ -0,0 +1,5 @@ +// check-pass +#![allow(dead_code)] +struct S([u8; { struct Z; 0 }]); + +fn main() {} diff --git a/tests/ui/issues/issue-2935.rs b/tests/ui/issues/issue-2935.rs new file mode 100644 index 000000000..37f818199 --- /dev/null +++ b/tests/ui/issues/issue-2935.rs @@ -0,0 +1,28 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +//type t = { a: isize }; +// type t = { a: bool }; +type t = bool; + +trait it { + fn f(&self); +} + +impl it for t { + fn f(&self) { } +} + +pub fn main() { + // let x = ({a: 4} as it); + // let y = box ({a: 4}); + // let z = box ({a: 4} as it); + // let z = box ({a: true} as it); + let z: Box<_> = Box::new(Box::new(true) as Box<dyn it>); + // x.f(); + // y.f(); + // (*z).f(); + println!("ok so far..."); + z.f(); //segfault +} diff --git a/tests/ui/issues/issue-29466.rs b/tests/ui/issues/issue-29466.rs new file mode 100644 index 000000000..f8785a632 --- /dev/null +++ b/tests/ui/issues/issue-29466.rs @@ -0,0 +1,3603 @@ +// ignore-tidy-filelength +// +// run-pass + +#![allow(unused_variables)] + +macro_rules! m( + ($e1:expr => $e2:expr) => ({ $e1 }) +); + +fn main() { + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + println!("{}", x); +} diff --git a/tests/ui/issues/issue-29485.rs b/tests/ui/issues/issue-29485.rs new file mode 100644 index 000000000..8d58ee6d9 --- /dev/null +++ b/tests/ui/issues/issue-29485.rs @@ -0,0 +1,19 @@ +// run-pass +#![allow(unused_attributes)] +// aux-build:issue-29485.rs +// needs-unwind +// ignore-emscripten no threads + +#[feature(recover)] + +extern crate a; + +fn main() { + let _ = std::thread::spawn(move || { + a::f(&mut a::X(0), g); + }).join(); +} + +fn g() { + panic!(); +} diff --git a/tests/ui/issues/issue-2951.rs b/tests/ui/issues/issue-2951.rs new file mode 100644 index 000000000..1798e3e75 --- /dev/null +++ b/tests/ui/issues/issue-2951.rs @@ -0,0 +1,11 @@ +fn foo<T, U>(x: T, y: U) { + let mut xx = x; + xx = y; + //~^ ERROR mismatched types + //~| expected type parameter `T`, found type parameter `U` + //~| expected type parameter `T` + //~| found type parameter `U` +} + +fn main() { +} diff --git a/tests/ui/issues/issue-2951.stderr b/tests/ui/issues/issue-2951.stderr new file mode 100644 index 000000000..538bbe2f5 --- /dev/null +++ b/tests/ui/issues/issue-2951.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/issue-2951.rs:3:10 + | +LL | fn foo<T, U>(x: T, y: U) { + | - - found type parameter + | | + | expected type parameter +LL | let mut xx = x; + | - expected due to this value +LL | xx = y; + | ^ expected type parameter `T`, found type parameter `U` + | + = note: expected type parameter `T` + found type parameter `U` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-29516.rs b/tests/ui/issues/issue-29516.rs new file mode 100644 index 000000000..6779d508d --- /dev/null +++ b/tests/ui/issues/issue-29516.rs @@ -0,0 +1,20 @@ +// check-pass +#![feature(auto_traits)] +#![feature(negative_impls)] + +auto trait NotSame {} + +impl<A> !NotSame for (A, A) {} + +trait OneOfEach {} + +impl<A> OneOfEach for (A,) {} + +impl<A, B> OneOfEach for (A, B) +where + (B,): OneOfEach, + (A, B): NotSame, +{ +} + +fn main() {} diff --git a/tests/ui/issues/issue-29522.rs b/tests/ui/issues/issue-29522.rs new file mode 100644 index 000000000..3d2de5ef6 --- /dev/null +++ b/tests/ui/issues/issue-29522.rs @@ -0,0 +1,17 @@ +// run-pass +#![allow(unused_variables)] +// check that we don't accidentally capture upvars just because their name +// occurs in a path + +fn assert_static<T: 'static>(_t: T) {} + +mod foo { + pub fn scope() {} +} + +fn main() { + let scope = &mut 0; + assert_static(|| { + foo::scope(); + }); +} diff --git a/tests/ui/issues/issue-29540.rs b/tests/ui/issues/issue-29540.rs new file mode 100644 index 000000000..c0de20822 --- /dev/null +++ b/tests/ui/issues/issue-29540.rs @@ -0,0 +1,492 @@ +// build-pass +#[derive(Debug)] +pub struct Config { + pub name: String, + pub cluster: String, + pub debug_none: String, + pub debug_lockdep: String, + pub debug_context: String, + pub debug_crush: String, + pub debug_mds: String, + pub debug_mds_balancer: String, + pub debug_mds_locker: String, + pub debug_mds_log: String, + pub debug_mds_log_expire: String, + pub debug_mds_migrator: String, + pub debug_buffer: String, + pub debug_timer: String, + pub debug_filer: String, + pub debug_striper: String, + pub debug_objecter: String, + pub debug_rados: String, + pub debug_rbd: String, + pub debug_journaler: String, + pub debug_objectcacher: String, + pub debug_client: String, + pub debug_osd: String, + pub debug_optracker: String, + pub debug_objclass: String, + pub debug_filestore: String, + pub debug_keyvaluestore: String, + pub debug_journal: String, + pub debug_ms: String, + pub debug_mon: String, + pub debug_monc: String, + pub debug_paxos: String, + pub debug_tp: String, + pub debug_auth: String, + pub debug_crypto: String, + pub debug_finisher: String, + pub debug_heartbeatmap: String, + pub debug_perfcounter: String, + pub debug_rgw: String, + pub debug_civetweb: String, + pub debug_javaclient: String, + pub debug_asok: String, + pub debug_throttle: String, + pub host: String, + pub fsid: String, + pub public_addr: String, + pub cluster_addr: String, + pub public_network: String, + pub cluster_network: String, + pub num_client: String, + pub monmap: String, + pub mon_host: String, + pub lockdep: String, + pub run_dir: String, + pub admin_socket: String, + pub daemonize: String, + pub pid_file: String, + pub chdir: String, + pub max_open_files: String, + pub restapi_log_level: String, + pub restapi_base_url: String, + pub fatal_signal_handlers: String, + pub log_file: String, + pub log_max_new: String, + pub log_max_recent: String, + pub log_to_stderr: String, + pub err_to_stderr: String, + pub log_to_syslog: String, + pub err_to_syslog: String, + pub log_flush_on_exit: String, + pub log_stop_at_utilization: String, + pub clog_to_monitors: String, + pub clog_to_syslog: String, + pub clog_to_syslog_level: String, + pub clog_to_syslog_facility: String, + pub mon_cluster_log_to_syslog: String, + pub mon_cluster_log_to_syslog_level: String, + pub mon_cluster_log_to_syslog_facility: String, + pub mon_cluster_log_file: String, + pub mon_cluster_log_file_level: String, + pub key: String, + pub keyfile: String, + pub keyring: String, + pub heartbeat_interval: String, + pub heartbeat_file: String, + pub heartbeat_inject_failure: String, + pub perf: String, + pub ms_tcp_nodelay: String, + pub ms_tcp_rcvbuf: String, + pub ms_initial_backoff: String, + pub ms_max_backoff: String, + pub ms_nocrc: String, + pub ms_die_on_bad_msg: String, + pub ms_die_on_unhandled_msg: String, + pub ms_die_on_old_message: String, + pub ms_dispatch_throttle_bytes: String, + pub ms_bind_ipv6: String, + pub ms_bind_port_min: String, + pub ms_bind_port_max: String, + pub ms_rwthread_stack_bytes: String, + pub ms_tcp_read_timeout: String, + pub ms_pq_max_tokens_per_priority: String, + pub ms_pq_min_cost: String, + pub ms_inject_socket_failures: String, + pub ms_inject_delay_type: String, + pub ms_inject_delay_msg_type: String, + pub ms_inject_delay_max: String, + pub ms_inject_delay_probability: String, + pub ms_inject_internal_delays: String, + pub ms_dump_on_send: String, + pub inject_early_sigterm: String, + pub mon_data: String, + pub mon_initial_members: String, + pub mon_sync_fs_threshold: String, + pub mon_compact_on_start: String, + pub mon_compact_on_bootstrap: String, + pub mon_compact_on_trim: String, + pub mon_tick_interval: String, + pub mon_subscribe_interval: String, + pub mon_delta_reset_interval: String, + pub mon_osd_laggy_halflife: String, + pub mon_osd_laggy_weight: String, + pub mon_osd_adjust_heartbeat_grace: String, + pub mon_osd_adjust_down_out_interval: String, + pub mon_osd_auto_mark_in: String, + pub mon_osd_auto_mark_auto_out_in: String, + pub mon_osd_auto_mark_new_in: String, + pub mon_osd_down_out_interval: String, + pub mon_osd_down_out_subtree_limit: String, + pub mon_osd_min_up_ratio: String, + pub mon_osd_min_in_ratio: String, + pub mon_osd_max_op_age: String, + pub mon_osd_max_split_count: String, + pub mon_osd_allow_primary_temp: String, + pub mon_osd_allow_primary_affinity: String, + pub mon_stat_smooth_intervals: String, + pub mon_lease: String, + pub mon_lease_renew_interval: String, + pub mon_lease_ack_timeout: String, + pub mon_clock_drift_allowed: String, + pub mon_clock_drift_warn_backoff: String, + pub mon_timecheck_interval: String, + pub mon_accept_timeout: String, + pub mon_pg_create_interval: String, + pub mon_pg_stuck_threshold: String, + pub mon_pg_warn_min_per_osd: String, + pub mon_pg_warn_max_object_skew: String, + pub mon_pg_warn_min_objects: String, + pub mon_pg_warn_min_pool_objects: String, + pub mon_cache_target_full_warn_ratio: String, + pub mon_osd_full_ratio: String, + pub mon_osd_nearfull_ratio: String, + pub mon_globalid_prealloc: String, + pub mon_osd_report_timeout: String, + pub mon_force_standby_active: String, + pub mon_warn_on_old_mons: String, + pub mon_warn_on_legacy_crush_tunables: String, + pub mon_warn_on_osd_down_out_interval_zero: String, + pub mon_warn_on_cache_pools_without_hit_sets: String, + pub mon_min_osdmap_epochs: String, + pub mon_max_pgmap_epochs: String, + pub mon_max_log_epochs: String, + pub mon_max_mdsmap_epochs: String, + pub mon_max_osd: String, + pub mon_probe_timeout: String, + pub mon_slurp_timeout: String, + pub mon_slurp_bytes: String, + pub mon_client_bytes: String, + pub mon_daemon_bytes: String, + pub mon_max_log_entries_per_event: String, + pub mon_health_data_update_interval: String, + pub mon_data_avail_crit: String, + pub mon_data_avail_warn: String, + pub mon_config_key_max_entry_size: String, + pub mon_sync_timeout: String, + pub mon_sync_max_payload_size: String, + pub mon_sync_debug: String, + pub mon_sync_debug_leader: String, + pub mon_sync_debug_provider: String, + pub mon_sync_debug_provider_fallback: String, + pub mon_inject_sync_get_chunk_delay: String, + pub mon_osd_min_down_reporters: String, + pub mon_osd_min_down_reports: String, + pub mon_osd_force_trim_to: String, + pub mon_mds_force_trim_to: String, + pub mon_advanced_debug_mode: String, + pub mon_debug_dump_transactions: String, + pub mon_debug_dump_location: String, + pub mon_sync_provider_kill_at: String, + pub mon_sync_requester_kill_at: String, + pub mon_leveldb_write_buffer_size: String, + pub mon_leveldb_cache_size: String, + pub mon_leveldb_block_size: String, + pub mon_leveldb_bloom_size: String, + pub mon_leveldb_max_open_files: String, + pub mon_leveldb_compression: String, + pub mon_leveldb_paranoid: String, + pub mon_leveldb_log: String, + pub mon_leveldb_size_warn: String, + pub mon_force_quorum_join: String, + pub paxos_stash_full_interval: String, + pub paxos_max_join_drift: String, + pub paxos_propose_interval: String, + pub paxos_min_wait: String, + pub paxos_min: String, + pub paxos_trim_min: String, + pub paxos_trim_max: String, + pub paxos_service_trim_min: String, + pub paxos_service_trim_max: String, + pub paxos_kill_at: String, + pub clock_offset: String, + pub auth_cluster_required: String, + pub auth_service_required: String, + pub auth_client_required: String, + pub auth_supported: String, + pub cephx_require_signatures: String, + pub cephx_cluster_require_signatures: String, + pub cephx_service_require_signatures: String, + pub cephx_sign_messages: String, + pub auth_mon_ticket_ttl: String, + pub auth_service_ticket_ttl: String, + pub auth_debug: String, + pub mon_client_hunt_interval: String, + pub mon_client_ping_interval: String, + pub mon_client_ping_timeout: String, + pub mon_client_hunt_interval_backoff: String, + pub mon_client_hunt_interval_max_multiple: String, + pub mon_client_max_log_entries_per_message: String, + pub mon_max_pool_pg_num: String, + pub mon_pool_quota_warn_threshold: String, + pub mon_pool_quota_crit_threshold: String, + pub client_cache_size: String, + pub client_cache_mid: String, + pub client_use_random_mds: String, + pub client_mount_timeout: String, + pub client_tick_interval: String, + pub client_trace: String, + pub client_readahead_min: String, + pub client_readahead_max_bytes: String, + pub client_readahead_max_periods: String, + pub client_snapdir: String, + pub client_mountpoint: String, + pub client_notify_timeout: String, + pub osd_client_watch_timeout: String, + pub client_caps_release_delay: String, + pub client_oc: String, + pub client_oc_size: String, + pub client_oc_max_dirty: String, + pub client_oc_target_dirty: String, + pub client_oc_max_dirty_age: String, + pub client_oc_max_objects: String, + pub client_debug_force_sync_read: String, + pub client_debug_inject_tick_delay: String, + pub client_max_inline_size: String, + pub fuse_use_invalidate_cb: String, + pub fuse_allow_other: String, + pub fuse_default_permissions: String, + pub fuse_big_writes: String, + pub fuse_atomic_o_trunc: String, + pub fuse_debug: String, + pub fuse_multithreaded: String, + pub crush_location: String, + pub objecter_tick_interval: String, + pub objecter_timeout: String, + pub objecter_inflight_op_bytes: String, + pub objecter_inflight_ops: String, + pub journaler_allow_split_entries: String, + pub journaler_write_head_interval: String, + pub journaler_prefetch_periods: String, + pub journaler_prezero_periods: String, + pub journaler_batch_interval: String, + pub journaler_batch_max: String, + pub mds_data: String, + pub mds_max_file_size: String, + pub mds_cache_size: String, + pub mds_cache_mid: String, + pub mds_mem_max: String, + pub mds_dir_max_commit_size: String, + pub mds_decay_halflife: String, + pub mds_beacon_interval: String, + pub mds_beacon_grace: String, + pub mds_enforce_unique_name: String, + pub mds_interval: String, + pub mds_session_timeout: String, + pub mds_freeze_tree_timeout: String, + pub mds_session_autoclose: String, + pub mds_reconnect_timeout: String, + pub mds_tick_interval: String, + pub mds_dirstat_min_interval: String, + pub mds_scatter_nudge_interval: String, + pub mds_client_prealloc_inos: String, + pub mds_early_reply: String, + pub mds_default_dir_hash: String, + pub mds_log: String, + pub mds_log_skip_corrupt_events: String, + pub mds_log_max_events: String, + pub mds_log_segment_size: String, + pub mds_log_max_segments: String, + pub mds_log_max_expiring: String, + pub mds_bal_sample_interval: String, + pub mds_bal_replicate_threshold: String, + pub mds_bal_unreplicate_threshold: String, + pub mds_bal_frag: String, + pub mds_bal_split_size: String, + pub mds_bal_split_rd: String, + pub mds_bal_split_wr: String, + pub mds_bal_split_bits: String, + pub mds_bal_merge_size: String, + pub mds_bal_merge_rd: String, + pub mds_bal_merge_wr: String, + pub mds_bal_interval: String, + pub mds_bal_fragment_interval: String, + pub mds_bal_idle_threshold: String, + pub mds_bal_max: String, + pub mds_bal_max_until: String, + pub mds_bal_mode: String, + pub mds_bal_min_rebalance: String, + pub mds_bal_min_start: String, + pub mds_bal_need_min: String, + pub mds_bal_need_max: String, + pub mds_bal_midchunk: String, + pub mds_bal_minchunk: String, + pub mds_bal_target_removal_min: String, + pub mds_bal_target_removal_max: String, + pub mds_replay_interval: String, + pub mds_shutdown_check: String, + pub mds_thrash_exports: String, + pub mds_thrash_fragments: String, + pub mds_dump_cache_on_map: String, + pub mds_dump_cache_after_rejoin: String, + pub mds_verify_scatter: String, + pub mds_debug_scatterstat: String, + pub mds_debug_frag: String, + pub mds_debug_auth_pins: String, + pub mds_debug_subtrees: String, + pub mds_kill_mdstable_at: String, + pub mds_kill_export_at: String, + pub mds_kill_import_at: String, + pub mds_kill_link_at: String, + pub mds_kill_rename_at: String, + pub mds_kill_openc_at: String, + pub mds_kill_journal_at: String, + pub mds_kill_journal_expire_at: String, + pub mds_kill_journal_replay_at: String, + pub mds_kill_create_at: String, + pub mds_open_remote_link_mode: String, + pub mds_inject_traceless_reply_probability: String, + pub mds_wipe_sessions: String, + pub mds_wipe_ino_prealloc: String, + pub mds_skip_ino: String, + pub max_mds: String, + pub mds_standby_for_name: String, + pub mds_standby_for_rank: String, + pub mds_standby_replay: String, + pub osd_compact_leveldb_on_mount: String, + pub osd_max_backfills: String, + pub osd_backfill_full_ratio: String, + pub osd_backfill_retry_interval: String, + pub osd_agent_max_ops: String, + pub osd_agent_min_evict_effort: String, + pub osd_agent_quantize_effort: String, + pub osd_agent_delay_time: String, + pub osd_agent_hist_halflife: String, + pub osd_agent_slop: String, + pub osd_uuid: String, + pub osd_data: String, + pub osd_journal: String, + pub osd_journal_size: String, + pub osd_max_write_size: String, + pub osd_max_pgls: String, + pub osd_client_message_size_cap: String, + pub osd_client_message_cap: String, + pub osd_pg_bits: String, + pub osd_pgp_bits: String, + pub osd_crush_chooseleaf_type: String, + pub osd_pool_default_crush_rule: String, + pub osd_pool_default_crush_replicated_ruleset: String, + pub osd_pool_erasure_code_stripe_width: String, + pub osd_pool_default_size: String, + pub osd_pool_default_min_size: String, + pub osd_pool_default_pg_num: String, + pub osd_pool_default_pgp_num: String, + pub osd_pool_default_erasure_code_directory: String, + pub osd_pool_default_erasure_code_profile: String, + pub osd_erasure_code_plugins: String, + pub osd_pool_default_flags: String, + pub osd_pool_default_flag_hashpspool: String, + pub osd_pool_default_hit_set_bloom_fpp: String, + pub osd_pool_default_cache_target_dirty_ratio: String, + pub osd_pool_default_cache_target_full_ratio: String, + pub osd_pool_default_cache_min_flush_age: String, + pub osd_pool_default_cache_min_evict_age: String, + pub osd_hit_set_min_size: String, + pub osd_hit_set_max_size: String, + pub osd_hit_set_namespace: String, + pub osd_tier_default_cache_mode: String, + pub osd_tier_default_cache_hit_set_count: String, + pub osd_tier_default_cache_hit_set_period: String, + pub osd_tier_default_cache_hit_set_type: String, + pub osd_map_dedup: String, + pub osd_map_max_advance: String, + pub osd_map_cache_size: String, + pub osd_map_message_max: String, + pub osd_map_share_max_epochs: String, + pub osd_op_threads: String, + pub osd_peering_wq_batch_size: String, + pub osd_op_pq_max_tokens_per_priority: String, + pub osd_op_pq_min_cost: String, + pub osd_disk_threads: String, + pub osd_disk_thread_ioprio_class: String, + pub osd_disk_thread_ioprio_priority: String, + pub osd_recovery_threads: String, + pub osd_recover_clone_overlap: String, + pub osd_recover_clone_overlap_limit: String, + pub osd_backfill_scan_min: String, + pub osd_backfill_scan_max: String, + pub osd_op_thread_timeout: String, + pub osd_recovery_thread_timeout: String, + pub osd_snap_trim_thread_timeout: String, + pub osd_snap_trim_sleep: String, + pub osd_scrub_thread_timeout: String, + pub osd_scrub_finalize_thread_timeout: String, + pub osd_scrub_invalid_stats: String, + pub osd_remove_thread_timeout: String, + pub osd_command_thread_timeout: String, + pub osd_age: String, + pub osd_age_time: String, + pub osd_heartbeat_addr: String, + pub osd_heartbeat_interval: String, + pub osd_heartbeat_grace: String, + pub osd_heartbeat_min_peers: String, + pub osd_pg_max_concurrent_snap_trims: String, + pub osd_heartbeat_min_healthy_ratio: String, + pub osd_mon_heartbeat_interval: String, + pub osd_mon_report_interval_max: String, + pub osd_mon_report_interval_min: String, + pub osd_pg_stat_report_interval_max: String, + pub osd_mon_ack_timeout: String, + pub osd_default_data_pool_replay_window: String, + pub osd_preserve_trimmed_log: String, + pub osd_auto_mark_unfound_lost: String, + pub osd_recovery_delay_start: String, + pub osd_recovery_max_active: String, + pub osd_recovery_max_single_start: String, + pub osd_recovery_max_chunk: String, + pub osd_copyfrom_max_chunk: String, + pub osd_push_per_object_cost: String, + pub osd_max_push_cost: String, + pub osd_max_push_objects: String, + pub osd_recovery_forget_lost_objects: String, + pub osd_max_scrubs: String, + pub osd_scrub_load_threshold: String, + pub osd_scrub_min_interval: String, + pub osd_scrub_max_interval: String, + pub osd_scrub_chunk_min: String, + pub osd_scrub_chunk_max: String, + pub osd_scrub_sleep: String, + pub osd_deep_scrub_interval: String, + pub osd_deep_scrub_stride: String, + pub osd_scan_list_ping_tp_interval: String, + pub osd_auto_weight: String, + pub osd_class_dir: String, + pub osd_open_classes_on_start: String, + pub osd_check_for_log_corruption: String, + pub osd_use_stale_snap: String, + pub osd_rollback_to_cluster_snap: String, + pub osd_default_notify_timeout: String, + pub osd_kill_backfill_at: String, + pub osd_pg_epoch_persisted_max_stale: String, + pub osd_min_pg_log_entries: String, + pub osd_max_pg_log_entries: String, + pub osd_op_complaint_time: String, + pub osd_command_max_records: String, + pub osd_op_log_threshold: String, + pub osd_verify_sparse_read_holes: String, + pub osd_debug_drop_ping_probability: String, + pub osd_debug_drop_ping_duration: String, + pub osd_debug_drop_pg_create_probability: String, + pub osd_debug_drop_pg_create_duration: String, + pub osd_debug_drop_op_probability: String, + pub osd_debug_op_order: String, + pub osd_debug_verify_snaps_on_info: String, + pub osd_debug_verify_stray_on_activate: String, + pub osd_debug_skip_full_check_in_backfill_reservation: String, + pub osd_debug_reject_backfill_probability: String, + pub osd_enable_op_tracker: String, +} + +fn main() {} diff --git a/tests/ui/issues/issue-29663.rs b/tests/ui/issues/issue-29663.rs new file mode 100644 index 000000000..e2e89a8bf --- /dev/null +++ b/tests/ui/issues/issue-29663.rs @@ -0,0 +1,56 @@ +// run-pass +#![allow(stable_features)] +// write_volatile causes an LLVM assert with composite types + +#![feature(volatile)] +use std::ptr::{read_volatile, write_volatile}; + +#[derive(Debug, Eq, PartialEq)] +struct A(u32); +#[derive(Debug, Eq, PartialEq)] +struct B(u64); +#[derive(Debug, Eq, PartialEq)] +struct C(u32, u32); +#[derive(Debug, Eq, PartialEq)] +struct D(u64, u64); +#[derive(Debug, Eq, PartialEq)] +struct E([u64; 32]); + +fn main() { + unsafe { + let mut x: u32 = 0; + write_volatile(&mut x, 1); + assert_eq!(read_volatile(&x), 1); + assert_eq!(x, 1); + + let mut x: u64 = 0; + write_volatile(&mut x, 1); + assert_eq!(read_volatile(&x), 1); + assert_eq!(x, 1); + + let mut x = A(0); + write_volatile(&mut x, A(1)); + assert_eq!(read_volatile(&x), A(1)); + assert_eq!(x, A(1)); + + let mut x = B(0); + write_volatile(&mut x, B(1)); + assert_eq!(read_volatile(&x), B(1)); + assert_eq!(x, B(1)); + + let mut x = C(0, 0); + write_volatile(&mut x, C(1, 1)); + assert_eq!(read_volatile(&x), C(1, 1)); + assert_eq!(x, C(1, 1)); + + let mut x = D(0, 0); + write_volatile(&mut x, D(1, 1)); + assert_eq!(read_volatile(&x), D(1, 1)); + assert_eq!(x, D(1, 1)); + + let mut x = E([0; 32]); + write_volatile(&mut x, E([1; 32])); + assert_eq!(read_volatile(&x), E([1; 32])); + assert_eq!(x, E([1; 32])); + } +} diff --git a/tests/ui/issues/issue-29668.rs b/tests/ui/issues/issue-29668.rs new file mode 100644 index 000000000..3d6c27bcd --- /dev/null +++ b/tests/ui/issues/issue-29668.rs @@ -0,0 +1,16 @@ +// run-pass +// Functions can return unnameable types + +mod m1 { + mod m2 { + #[derive(Debug)] + pub struct A; + } + use self::m2::A; + pub fn x() -> A { A } +} + +fn main() { + let x = m1::x(); + println!("{:?}", x); +} diff --git a/tests/ui/issues/issue-29710.rs b/tests/ui/issues/issue-29710.rs new file mode 100644 index 000000000..bc98d389c --- /dev/null +++ b/tests/ui/issues/issue-29710.rs @@ -0,0 +1,11 @@ +// check-pass +#![deny(unused_results)] +#![allow(dead_code)] + +#[derive(Debug)] +struct A(usize); + +#[derive(Debug)] +struct B { a: usize } + +fn main() {} diff --git a/tests/ui/issues/issue-29723.rs b/tests/ui/issues/issue-29723.rs new file mode 100644 index 000000000..399e9ba0d --- /dev/null +++ b/tests/ui/issues/issue-29723.rs @@ -0,0 +1,22 @@ +// test for https://github.com/rust-lang/rust/issues/29723 + +#![feature(if_let_guard)] + +fn main() { + let s = String::new(); + let _s = match 0 { + 0 if { drop(s); false } => String::from("oops"), + _ => { + // This should trigger an error, + // s could have been moved from. + s + //~^ ERROR use of moved value: `s` + } + }; + + let s = String::new(); + let _s = match 0 { + 0 if let Some(()) = { drop(s); None } => String::from("oops"), + _ => s //~ ERROR use of moved value: `s` + }; +} diff --git a/tests/ui/issues/issue-29723.stderr b/tests/ui/issues/issue-29723.stderr new file mode 100644 index 000000000..044d8a9b5 --- /dev/null +++ b/tests/ui/issues/issue-29723.stderr @@ -0,0 +1,36 @@ +error[E0382]: use of moved value: `s` + --> $DIR/issue-29723.rs:12:13 + | +LL | let s = String::new(); + | - move occurs because `s` has type `String`, which does not implement the `Copy` trait +LL | let _s = match 0 { +LL | 0 if { drop(s); false } => String::from("oops"), + | - value moved here +... +LL | s + | ^ value used here after move + | +help: consider cloning the value if the performance cost is acceptable + | +LL | 0 if { drop(s.clone()); false } => String::from("oops"), + | ++++++++ + +error[E0382]: use of moved value: `s` + --> $DIR/issue-29723.rs:20:14 + | +LL | let s = String::new(); + | - move occurs because `s` has type `String`, which does not implement the `Copy` trait +LL | let _s = match 0 { +LL | 0 if let Some(()) = { drop(s); None } => String::from("oops"), + | - value moved here +LL | _ => s + | ^ value used here after move + | +help: consider cloning the value if the performance cost is acceptable + | +LL | 0 if let Some(()) = { drop(s.clone()); None } => String::from("oops"), + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-29740.rs b/tests/ui/issues/issue-29740.rs new file mode 100644 index 000000000..20398890b --- /dev/null +++ b/tests/ui/issues/issue-29740.rs @@ -0,0 +1,317 @@ +// check-pass +#![allow(dead_code)] +// Regression test for #29740. Inefficient MIR matching algorithms +// generated way too much code for this sort of case, leading to OOM. +#![allow(non_snake_case)] + +pub mod KeyboardEventConstants { + pub const DOM_KEY_LOCATION_STANDARD: u32 = 0; + pub const DOM_KEY_LOCATION_LEFT: u32 = 1; + pub const DOM_KEY_LOCATION_RIGHT: u32 = 2; + pub const DOM_KEY_LOCATION_NUMPAD: u32 = 3; +} // mod KeyboardEventConstants + +pub enum Key { + Space, + Apostrophe, + Comma, + Minus, + Period, + Slash, + Num0, + Num1, + Num2, + Num3, + Num4, + Num5, + Num6, + Num7, + Num8, + Num9, + Semicolon, + Equal, + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, + L, + M, + N, + O, + P, + Q, + R, + S, + T, + U, + V, + W, + X, + Y, + Z, + LeftBracket, + Backslash, + RightBracket, + GraveAccent, + World1, + World2, + + Escape, + Enter, + Tab, + Backspace, + Insert, + Delete, + Right, + Left, + Down, + Up, + PageUp, + PageDown, + Home, + End, + CapsLock, + ScrollLock, + NumLock, + PrintScreen, + Pause, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + F16, + F17, + F18, + F19, + F20, + F21, + F22, + F23, + F24, + F25, + Kp0, + Kp1, + Kp2, + Kp3, + Kp4, + Kp5, + Kp6, + Kp7, + Kp8, + Kp9, + KpDecimal, + KpDivide, + KpMultiply, + KpSubtract, + KpAdd, + KpEnter, + KpEqual, + LeftShift, + LeftControl, + LeftAlt, + LeftSuper, + RightShift, + RightControl, + RightAlt, + RightSuper, + Menu, +} + +fn key_from_string(key_string: &str, location: u32) -> Option<Key> { + match key_string { + " " => Some(Key::Space), + "\"" => Some(Key::Apostrophe), + "'" => Some(Key::Apostrophe), + "<" => Some(Key::Comma), + "," => Some(Key::Comma), + "_" => Some(Key::Minus), + "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Minus), + ">" => Some(Key::Period), + "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Period), + "?" => Some(Key::Slash), + "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Slash), + "~" => Some(Key::GraveAccent), + "`" => Some(Key::GraveAccent), + ")" => Some(Key::Num0), + "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num0), + "!" => Some(Key::Num1), + "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num1), + "@" => Some(Key::Num2), + "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num2), + "#" => Some(Key::Num3), + "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num3), + "$" => Some(Key::Num4), + "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num4), + "%" => Some(Key::Num5), + "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num5), + "^" => Some(Key::Num6), + "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num6), + "&" => Some(Key::Num7), + "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num7), + "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), + "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), + "(" => Some(Key::Num9), + "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num9), + ":" => Some(Key::Semicolon), + ";" => Some(Key::Semicolon), + "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), + "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), + "A" => Some(Key::A), + "a" => Some(Key::A), + "B" => Some(Key::B), + "b" => Some(Key::B), + "C" => Some(Key::C), + "c" => Some(Key::C), + "D" => Some(Key::D), + "d" => Some(Key::D), + "E" => Some(Key::E), + "e" => Some(Key::E), + "F" => Some(Key::F), + "f" => Some(Key::F), + "G" => Some(Key::G), + "g" => Some(Key::G), + "H" => Some(Key::H), + "h" => Some(Key::H), + "I" => Some(Key::I), + "i" => Some(Key::I), + "J" => Some(Key::J), + "j" => Some(Key::J), + "K" => Some(Key::K), + "k" => Some(Key::K), + "L" => Some(Key::L), + "l" => Some(Key::L), + "M" => Some(Key::M), + "m" => Some(Key::M), + "N" => Some(Key::N), + "n" => Some(Key::N), + "O" => Some(Key::O), + "o" => Some(Key::O), + "P" => Some(Key::P), + "p" => Some(Key::P), + "Q" => Some(Key::Q), + "q" => Some(Key::Q), + "R" => Some(Key::R), + "r" => Some(Key::R), + "S" => Some(Key::S), + "s" => Some(Key::S), + "T" => Some(Key::T), + "t" => Some(Key::T), + "U" => Some(Key::U), + "u" => Some(Key::U), + "V" => Some(Key::V), + "v" => Some(Key::V), + "W" => Some(Key::W), + "w" => Some(Key::W), + "X" => Some(Key::X), + "x" => Some(Key::X), + "Y" => Some(Key::Y), + "y" => Some(Key::Y), + "Z" => Some(Key::Z), + "z" => Some(Key::Z), + "{" => Some(Key::LeftBracket), + "[" => Some(Key::LeftBracket), + "|" => Some(Key::Backslash), + "\\" => Some(Key::Backslash), + "}" => Some(Key::RightBracket), + "]" => Some(Key::RightBracket), + "Escape" => Some(Key::Escape), + "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD + => Some(Key::Enter), + "Tab" => Some(Key::Tab), + "Backspace" => Some(Key::Backspace), + "Insert" => Some(Key::Insert), + "Delete" => Some(Key::Delete), + "ArrowRight" => Some(Key::Right), + "ArrowLeft" => Some(Key::Left), + "ArrowDown" => Some(Key::Down), + "ArrowUp" => Some(Key::Up), + "PageUp" => Some(Key::PageUp), + "PageDown" => Some(Key::PageDown), + "Home" => Some(Key::Home), + "End" => Some(Key::End), + "CapsLock" => Some(Key::CapsLock), + "ScrollLock" => Some(Key::ScrollLock), + "NumLock" => Some(Key::NumLock), + "PrintScreen" => Some(Key::PrintScreen), + "Pause" => Some(Key::Pause), + "F1" => Some(Key::F1), + "F2" => Some(Key::F2), + "F3" => Some(Key::F3), + "F4" => Some(Key::F4), + "F5" => Some(Key::F5), + "F6" => Some(Key::F6), + "F7" => Some(Key::F7), + "F8" => Some(Key::F8), + "F9" => Some(Key::F9), + "F10" => Some(Key::F10), + "F11" => Some(Key::F11), + "F12" => Some(Key::F12), + "F13" => Some(Key::F13), + "F14" => Some(Key::F14), + "F15" => Some(Key::F15), + "F16" => Some(Key::F16), + "F17" => Some(Key::F17), + "F18" => Some(Key::F18), + "F19" => Some(Key::F19), + "F20" => Some(Key::F20), + "F21" => Some(Key::F21), + "F22" => Some(Key::F22), + "F23" => Some(Key::F23), + "F24" => Some(Key::F24), + "F25" => Some(Key::F25), + "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp0), + "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp1), + "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp2), + "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp3), + "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp4), + "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp5), + "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp6), + "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp7), + "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp8), + "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp9), + "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDecimal), + "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDivide), + "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpMultiply), + "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpSubtract), + "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpAdd), + "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD + => Some(Key::KpEnter), + "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpEqual), + "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT + => Some(Key::LeftShift), + "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT + => Some(Key::LeftControl), + "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT => Some(Key::LeftAlt), + "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT + => Some(Key::LeftSuper), + "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT + => Some(Key::RightShift), + "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT + => Some(Key::RightControl), + "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightAlt), + "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT + => Some(Key::RightSuper), + "ContextMenu" => Some(Key::Menu), + _ => None + } +} + +fn main() { } diff --git a/tests/ui/issues/issue-29743.rs b/tests/ui/issues/issue-29743.rs new file mode 100644 index 000000000..250cd7e1b --- /dev/null +++ b/tests/ui/issues/issue-29743.rs @@ -0,0 +1,7 @@ +// check-pass + +fn main() { + let mut i = [1, 2, 3]; + i[i[0]] = 0; + i[i[0] - 1] = 0; +} diff --git a/tests/ui/issues/issue-29746.rs b/tests/ui/issues/issue-29746.rs new file mode 100644 index 000000000..3470a7e09 --- /dev/null +++ b/tests/ui/issues/issue-29746.rs @@ -0,0 +1,36 @@ +// run-pass +// zip!(a1,a2,a3,a4) is equivalent to: +// a1.zip(a2).zip(a3).zip(a4).map(|(((x1,x2),x3),x4)| (x1,x2,x3,x4)) +macro_rules! zip { + // Entry point + ([$a:expr, $b:expr, $($rest:expr),*]) => { + zip!([$($rest),*], $a.zip($b), (x,y), [x,y]) + }; + + // Intermediate steps to build the zipped expression, the match pattern + // and the output tuple of the closure, using macro hygiene to repeatedly + // introduce new variables named 'x'. + ([$a:expr, $($rest:expr),*], $zip:expr, $pat:pat, [$($flat:expr),*]) => { + zip!([$($rest),*], $zip.zip($a), ($pat,x), [$($flat),*, x]) + }; + + // Final step + ([], $zip:expr, $pat:pat, [$($flat:expr),+]) => { + $zip.map(|$pat| ($($flat),+)) + }; + + // Comma + ([$a:expr], $zip:expr, $pat:pat, [$($flat:expr),*]) => { + zip!([$a,], $zip, $pat, [$($flat),*]) + }; +} + +fn main() { + let p1 = vec![1i32, 2].into_iter(); + let p2 = vec!["10", "20"].into_iter(); + let p3 = vec![100u16, 200].into_iter(); + let p4 = vec![1000i64, 2000].into_iter(); + + let e = zip!([p1,p2,p3,p4]).collect::<Vec<_>>(); + assert_eq!(e[0], (1i32,"10",100u16,1000i64)); +} diff --git a/tests/ui/issues/issue-29798.rs b/tests/ui/issues/issue-29798.rs new file mode 100644 index 000000000..5eff5d191 --- /dev/null +++ b/tests/ui/issues/issue-29798.rs @@ -0,0 +1,11 @@ +// run-fail +// error-pattern:index out of bounds: the len is 5 but the index is 5 +// ignore-emscripten no processes + +const fn test(x: usize) -> i32 { + [42;5][x] +} + +fn main () { + let _ = test(5); +} diff --git a/tests/ui/issues/issue-29821.rs b/tests/ui/issues/issue-29821.rs new file mode 100644 index 000000000..54be3afb5 --- /dev/null +++ b/tests/ui/issues/issue-29821.rs @@ -0,0 +1,19 @@ +// build-pass + +pub trait Foo { + type FooAssoc; +} + +pub struct Bar<F: Foo> { + id: F::FooAssoc +} + +pub struct Baz; + +impl Foo for Baz { + type FooAssoc = usize; +} + +static mut MY_FOO: Bar<Baz> = Bar { id: 0 }; + +fn main() {} diff --git a/tests/ui/issues/issue-29857.rs b/tests/ui/issues/issue-29857.rs new file mode 100644 index 000000000..6f4c5f45d --- /dev/null +++ b/tests/ui/issues/issue-29857.rs @@ -0,0 +1,19 @@ +// check-pass + +use std::marker::PhantomData; + +pub trait Foo<P> {} + +impl <P, T: Foo<P>> Foo<P> for Option<T> {} + +pub struct Qux<T> (PhantomData<*mut T>); + +impl<T> Foo<*mut T> for Option<Qux<T>> {} + +pub trait Bar { + type Output: 'static; +} + +impl<T: 'static, W: Bar<Output = T>> Foo<*mut T> for W {} + +fn main() {} diff --git a/tests/ui/issues/issue-29861.rs b/tests/ui/issues/issue-29861.rs new file mode 100644 index 000000000..58f8eb536 --- /dev/null +++ b/tests/ui/issues/issue-29861.rs @@ -0,0 +1,20 @@ +pub trait MakeRef<'a> { + type Ref; +} +impl<'a, T: 'a> MakeRef<'a> for T { + type Ref = &'a T; +} + +pub trait MakeRef2 { + type Ref2; +} +impl<'a, T: 'a> MakeRef2 for T { +//~^ ERROR the lifetime parameter `'a` is not constrained + type Ref2 = <T as MakeRef<'a>>::Ref; +} + +fn foo() -> <String as MakeRef2>::Ref2 { &String::from("foo") } + +fn main() { + println!("{}", foo()); +} diff --git a/tests/ui/issues/issue-29861.stderr b/tests/ui/issues/issue-29861.stderr new file mode 100644 index 000000000..d9d3cf360 --- /dev/null +++ b/tests/ui/issues/issue-29861.stderr @@ -0,0 +1,9 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-29861.rs:11:6 + | +LL | impl<'a, T: 'a> MakeRef2 for T { + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/issues/issue-2989.rs b/tests/ui/issues/issue-2989.rs new file mode 100644 index 000000000..c0b673743 --- /dev/null +++ b/tests/ui/issues/issue-2989.rs @@ -0,0 +1,36 @@ +// run-pass +#![allow(non_camel_case_types)] + +trait methods { + fn to_bytes(&self) -> Vec<u8> ; +} + +impl methods for () { + fn to_bytes(&self) -> Vec<u8> { + Vec::new() + } +} + +// the position of this function is significant! - if it comes before methods +// then it works, if it comes after it then it doesn't! +fn to_bools(bitv: Storage) -> Vec<bool> { + (0..8).map(|i| { + let w = i / 64; + let b = i % 64; + let x = 1 & (bitv.storage[w] >> b); + x == 1 + }).collect() +} + +struct Storage { storage: Vec<u64> } + +pub fn main() { + let bools = vec![false, false, true, false, false, true, true, false]; + let bools2 = to_bools(Storage{storage: vec![0b01100100]}); + + for i in 0..8 { + println!("{} => {} vs {}", i, bools[i], bools2[i]); + } + + assert_eq!(bools, bools2); +} diff --git a/tests/ui/issues/issue-29948.rs b/tests/ui/issues/issue-29948.rs new file mode 100644 index 000000000..3ed701480 --- /dev/null +++ b/tests/ui/issues/issue-29948.rs @@ -0,0 +1,40 @@ +// run-pass +// needs-unwind + +use std::panic; + +impl<'a> panic::UnwindSafe for Foo<'a> {} +impl<'a> panic::RefUnwindSafe for Foo<'a> {} + +struct Foo<'a>(&'a mut bool); + +impl<'a> Drop for Foo<'a> { + fn drop(&mut self) { + *self.0 = true; + } +} + +fn f<T: FnOnce()>(t: T) { + t() +} + +fn main() { + let mut ran_drop = false; + { + let x = Foo(&mut ran_drop); + let x = move || { let _ = x; }; + f(x); + } + assert!(ran_drop); + + let mut ran_drop = false; + { + let x = Foo(&mut ran_drop); + let result = panic::catch_unwind(move || { + let x = move || { let _ = x; panic!() }; + f(x); + }); + assert!(result.is_err()); + } + assert!(ran_drop); +} diff --git a/tests/ui/issues/issue-2995.rs b/tests/ui/issues/issue-2995.rs new file mode 100644 index 000000000..0da790948 --- /dev/null +++ b/tests/ui/issues/issue-2995.rs @@ -0,0 +1,5 @@ +fn bad (p: *const isize) { + let _q: &isize = p as &isize; //~ ERROR non-primitive cast +} + +fn main() { } diff --git a/tests/ui/issues/issue-2995.stderr b/tests/ui/issues/issue-2995.stderr new file mode 100644 index 000000000..0d09612c6 --- /dev/null +++ b/tests/ui/issues/issue-2995.stderr @@ -0,0 +1,15 @@ +error[E0605]: non-primitive cast: `*const isize` as `&isize` + --> $DIR/issue-2995.rs:2:22 + | +LL | let _q: &isize = p as &isize; + | ^^^^^^^^^^^ invalid cast + | +help: consider borrowing the value + | +LL - let _q: &isize = p as &isize; +LL + let _q: &isize = &*p; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0605`. diff --git a/tests/ui/issues/issue-30007.rs b/tests/ui/issues/issue-30007.rs new file mode 100644 index 000000000..918a821ba --- /dev/null +++ b/tests/ui/issues/issue-30007.rs @@ -0,0 +1,7 @@ +macro_rules! t { + () => ( String ; ); //~ ERROR macro expansion ignores token `;` +} + +fn main() { + let i: Vec<t!()>; +} diff --git a/tests/ui/issues/issue-30007.stderr b/tests/ui/issues/issue-30007.stderr new file mode 100644 index 000000000..87e770e15 --- /dev/null +++ b/tests/ui/issues/issue-30007.stderr @@ -0,0 +1,13 @@ +error: macro expansion ignores token `;` and any following + --> $DIR/issue-30007.rs:2:20 + | +LL | () => ( String ; ); + | ^ +... +LL | let i: Vec<t!()>; + | ---- caused by the macro expansion here + | + = note: the usage of `t!` is likely invalid in type context + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-30018-panic.rs b/tests/ui/issues/issue-30018-panic.rs new file mode 100644 index 000000000..cba3055a2 --- /dev/null +++ b/tests/ui/issues/issue-30018-panic.rs @@ -0,0 +1,26 @@ +// run-pass +// Regression test for Issue #30018. This is very similar to the +// original reported test, except that the panic is wrapped in a +// spawned thread to isolate the expected error result from the +// SIGTRAP injected by the drop-flag consistency checking. + +// needs-unwind +// ignore-emscripten no threads support + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) {} +} + +fn foo() -> Foo { + panic!(); +} + +fn main() { + use std::thread; + let handle = thread::spawn(|| { + let _ = &[foo()]; + }); + let _ = handle.join(); +} diff --git a/tests/ui/issues/issue-3008-1.rs b/tests/ui/issues/issue-3008-1.rs new file mode 100644 index 000000000..1124969e6 --- /dev/null +++ b/tests/ui/issues/issue-3008-1.rs @@ -0,0 +1,12 @@ +enum Foo { + Foo_(Bar) +} + +enum Bar { + //~^ ERROR recursive type `Bar` has infinite size + BarNone, + BarSome(Bar) +} + +fn main() { +} diff --git a/tests/ui/issues/issue-3008-1.stderr b/tests/ui/issues/issue-3008-1.stderr new file mode 100644 index 000000000..be25b9091 --- /dev/null +++ b/tests/ui/issues/issue-3008-1.stderr @@ -0,0 +1,17 @@ +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-3008-1.rs:5:1 + | +LL | enum Bar { + | ^^^^^^^^ +... +LL | BarSome(Bar) + | --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | BarSome(Box<Bar>) + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-3008-2.rs b/tests/ui/issues/issue-3008-2.rs new file mode 100644 index 000000000..5846c69da --- /dev/null +++ b/tests/ui/issues/issue-3008-2.rs @@ -0,0 +1,6 @@ +enum Foo { Foo_(Bar) } +struct Bar { x: Bar } +//~^ ERROR E0072 + +fn main() { +} diff --git a/tests/ui/issues/issue-3008-2.stderr b/tests/ui/issues/issue-3008-2.stderr new file mode 100644 index 000000000..858a8fd6a --- /dev/null +++ b/tests/ui/issues/issue-3008-2.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-3008-2.rs:2:1 + | +LL | struct Bar { x: Bar } + | ^^^^^^^^^^ --- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Bar { x: Box<Bar> } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-3008-3.rs b/tests/ui/issues/issue-3008-3.rs new file mode 100644 index 000000000..212eb2eb8 --- /dev/null +++ b/tests/ui/issues/issue-3008-3.rs @@ -0,0 +1,10 @@ +use std::marker; + +enum E1 { V1(E2<E1>), } +enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), } +//~^ ERROR recursive type `E2` has infinite size + +impl E1 { fn foo(&self) {} } + +fn main() { +} diff --git a/tests/ui/issues/issue-3008-3.stderr b/tests/ui/issues/issue-3008-3.stderr new file mode 100644 index 000000000..a1a81e293 --- /dev/null +++ b/tests/ui/issues/issue-3008-3.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `E2` has infinite size + --> $DIR/issue-3008-3.rs:4:1 + | +LL | enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), } + | ^^^^^^^^^^ ------ recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | enum E2<T> { V2(Box<E2<E1>>, marker::PhantomData<T>), } + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-30081.rs b/tests/ui/issues/issue-30081.rs new file mode 100644 index 000000000..e7fca96ed --- /dev/null +++ b/tests/ui/issues/issue-30081.rs @@ -0,0 +1,15 @@ +// run-pass +// This used to segfault #30081 + +pub enum Instruction { + Increment(i8), + Loop(Box<Box<()>>), +} + +fn main() { + let instrs: Option<(u8, Box<Instruction>)> = None; + instrs.into_iter() + .map(|(_, instr)| instr) + .map(|instr| match *instr { _other => {} }) + .last(); +} diff --git a/tests/ui/issues/issue-3012-2.rs b/tests/ui/issues/issue-3012-2.rs new file mode 100644 index 000000000..7d32c51f5 --- /dev/null +++ b/tests/ui/issues/issue-3012-2.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:issue-3012-1.rs + +// pretty-expanded FIXME #23616 + +extern crate socketlib; + +use socketlib::socket; + +pub fn main() { + let fd: u32 = 1 as u32; + let _sock: Box<_> = Box::new(socket::socket_handle(fd)); +} diff --git a/tests/ui/issues/issue-30123.rs b/tests/ui/issues/issue-30123.rs new file mode 100644 index 000000000..705355d91 --- /dev/null +++ b/tests/ui/issues/issue-30123.rs @@ -0,0 +1,9 @@ +// aux-build:issue-30123-aux.rs + +extern crate issue_30123_aux; +use issue_30123_aux::*; + +fn main() { + let ug = Graph::<i32, i32>::new_undirected(); + //~^ ERROR no function or associated item named `new_undirected` found +} diff --git a/tests/ui/issues/issue-30123.stderr b/tests/ui/issues/issue-30123.stderr new file mode 100644 index 000000000..7808cbf8a --- /dev/null +++ b/tests/ui/issues/issue-30123.stderr @@ -0,0 +1,12 @@ +error[E0599]: no function or associated item named `new_undirected` found for struct `Graph<i32, i32>` in the current scope + --> $DIR/issue-30123.rs:7:33 + | +LL | let ug = Graph::<i32, i32>::new_undirected(); + | ^^^^^^^^^^^^^^ function or associated item not found in `Graph<i32, i32>` + | + = note: the function or associated item was found for + - `issue_30123_aux::Graph<N, E, Undirected>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-3021-b.rs b/tests/ui/issues/issue-3021-b.rs new file mode 100644 index 000000000..f1630afe1 --- /dev/null +++ b/tests/ui/issues/issue-3021-b.rs @@ -0,0 +1,14 @@ +fn siphash(k0 : u64) { + + struct SipHash { + v0: u64, + } + + impl SipHash { + pub fn reset(&mut self) { + self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment + } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-3021-b.stderr b/tests/ui/issues/issue-3021-b.stderr new file mode 100644 index 000000000..72289c5f9 --- /dev/null +++ b/tests/ui/issues/issue-3021-b.stderr @@ -0,0 +1,11 @@ +error[E0434]: can't capture dynamic environment in a fn item + --> $DIR/issue-3021-b.rs:9:22 + | +LL | self.v0 = k0 ^ 0x736f6d6570736575; + | ^^ + | + = help: use the `|| { ... }` closure form instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0434`. diff --git a/tests/ui/issues/issue-3021-d.rs b/tests/ui/issues/issue-3021-d.rs new file mode 100644 index 000000000..1fb0002b2 --- /dev/null +++ b/tests/ui/issues/issue-3021-d.rs @@ -0,0 +1,28 @@ +trait SipHash { + fn result(&self) -> u64; + fn reset(&self); +} + +fn siphash(k0 : u64, k1 : u64) { + struct SipState { + v0: u64, + v1: u64, + } + + fn mk_result(st : &SipState) -> u64 { + + let v0 = st.v0; + let v1 = st.v1; + return v0 ^ v1; + } + + impl SipHash for SipState { + fn reset(&self) { + self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment + self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment + } + fn result(&self) -> u64 { return mk_result(self); } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-3021-d.stderr b/tests/ui/issues/issue-3021-d.stderr new file mode 100644 index 000000000..39e6e8c43 --- /dev/null +++ b/tests/ui/issues/issue-3021-d.stderr @@ -0,0 +1,19 @@ +error[E0434]: can't capture dynamic environment in a fn item + --> $DIR/issue-3021-d.rs:21:23 + | +LL | self.v0 = k0 ^ 0x736f6d6570736575; + | ^^ + | + = help: use the `|| { ... }` closure form instead + +error[E0434]: can't capture dynamic environment in a fn item + --> $DIR/issue-3021-d.rs:22:23 + | +LL | self.v1 = k1 ^ 0x646f72616e646f6d; + | ^^ + | + = help: use the `|| { ... }` closure form instead + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0434`. diff --git a/tests/ui/issues/issue-30236.rs b/tests/ui/issues/issue-30236.rs new file mode 100644 index 000000000..9c2d85507 --- /dev/null +++ b/tests/ui/issues/issue-30236.rs @@ -0,0 +1,7 @@ +type Foo< + Unused //~ ERROR type parameter `Unused` is unused + > = u8; + +fn main() { + +} diff --git a/tests/ui/issues/issue-30236.stderr b/tests/ui/issues/issue-30236.stderr new file mode 100644 index 000000000..64cbd58d6 --- /dev/null +++ b/tests/ui/issues/issue-30236.stderr @@ -0,0 +1,9 @@ +error[E0091]: type parameter `Unused` is unused + --> $DIR/issue-30236.rs:2:5 + | +LL | Unused + | ^^^^^^ unused type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0091`. diff --git a/tests/ui/issues/issue-30255.rs b/tests/ui/issues/issue-30255.rs new file mode 100644 index 000000000..6970a122b --- /dev/null +++ b/tests/ui/issues/issue-30255.rs @@ -0,0 +1,24 @@ +// +// Test that lifetime elision error messages correctly omit parameters +// with no elided lifetimes + +struct S<'a> { + field: &'a i32, +} + +fn f(a: &S, b: i32) -> &i32 { +//~^ ERROR missing lifetime specifier [E0106] + panic!(); +} + +fn g(a: &S, b: bool, c: &i32) -> &i32 { +//~^ ERROR missing lifetime specifier [E0106] + panic!(); +} + +fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { +//~^ ERROR missing lifetime specifier [E0106] + panic!(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-30255.stderr b/tests/ui/issues/issue-30255.stderr new file mode 100644 index 000000000..adb721a1c --- /dev/null +++ b/tests/ui/issues/issue-30255.stderr @@ -0,0 +1,39 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:9:24 + | +LL | fn f(a: &S, b: i32) -> &i32 { + | -- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `a`'s 2 lifetimes it is borrowed from +help: consider introducing a named lifetime parameter + | +LL | fn f<'a>(a: &'a S<'a>, b: i32) -> &'a i32 { + | ++++ ++ ++++ ++ + +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:14:34 + | +LL | fn g(a: &S, b: bool, c: &i32) -> &i32 { + | -- ---- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` +help: consider introducing a named lifetime parameter + | +LL | fn g<'a>(a: &'a S<'a>, b: bool, c: &'a i32) -> &'a i32 { + | ++++ ++ ++++ ++ ++ + +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:19:44 + | +LL | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { + | ----- -- ---- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d` +help: consider introducing a named lifetime parameter + | +LL | fn h<'a>(a: &'a bool, b: bool, c: &'a S<'a>, d: &'a i32) -> &'a i32 { + | ++++ ++ ++ ++++ ++ ++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/issues/issue-3026.rs b/tests/ui/issues/issue-3026.rs new file mode 100644 index 000000000..4619a3fe7 --- /dev/null +++ b/tests/ui/issues/issue-3026.rs @@ -0,0 +1,11 @@ +// run-pass +// pretty-expanded FIXME #23616 + +use std::collections::HashMap; + +pub fn main() { + let x: Box<_>; + let mut buggy_map: HashMap<usize, &usize> = HashMap::new(); + x = Box::new(1); + buggy_map.insert(42, &*x); +} diff --git a/tests/ui/issues/issue-3029.rs b/tests/ui/issues/issue-3029.rs new file mode 100644 index 000000000..a5d30960a --- /dev/null +++ b/tests/ui/issues/issue-3029.rs @@ -0,0 +1,14 @@ +// run-fail +// error-pattern:so long +// ignore-emscripten no processes + +#![allow(unused_allocation)] +#![allow(unreachable_code)] +#![allow(unused_variables)] + +fn main() { + let mut x = Vec::new(); + let y = vec![3]; + panic!("so long"); + x.extend(y.into_iter()); +} diff --git a/tests/ui/issues/issue-3037.rs b/tests/ui/issues/issue-3037.rs new file mode 100644 index 000000000..ff4d32c28 --- /dev/null +++ b/tests/ui/issues/issue-3037.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 +#![allow(non_camel_case_types)] + +enum what { } + +fn what_to_string(x: what) -> String +{ + match x { + } +} + +pub fn main() +{ +} diff --git a/tests/ui/issues/issue-30371.rs b/tests/ui/issues/issue-30371.rs new file mode 100644 index 000000000..eea548c48 --- /dev/null +++ b/tests/ui/issues/issue-30371.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(unreachable_code)] +#![allow(for_loops_over_fallibles)] +#![deny(unused_variables)] + +fn main() { + for _ in match return () { + () => Some(0), + } {} +} diff --git a/tests/ui/issues/issue-3038.rs b/tests/ui/issues/issue-3038.rs new file mode 100644 index 000000000..cf3ba009f --- /dev/null +++ b/tests/ui/issues/issue-3038.rs @@ -0,0 +1,26 @@ +enum F { G(isize, isize) } + +enum H { I(J, K) } + +enum J { L(isize, isize) } +enum K { M(isize, isize) } + +fn main() +{ + + let _z = match F::G(1, 2) { + F::G(x, x) => { println!("{}", x + x); } + //~^ ERROR identifier `x` is bound more than once in the same pattern + }; + + let _z = match H::I(J::L(1, 2), K::M(3, 4)) { + H::I(J::L(x, _), K::M(_, x)) + //~^ ERROR identifier `x` is bound more than once in the same pattern + => { println!("{}", x + x); } + }; + + let _z = match (1, 2) { + (x, x) => { x } //~ ERROR identifier `x` is bound more than once in the same pattern + }; + +} diff --git a/tests/ui/issues/issue-3038.stderr b/tests/ui/issues/issue-3038.stderr new file mode 100644 index 000000000..210da2cef --- /dev/null +++ b/tests/ui/issues/issue-3038.stderr @@ -0,0 +1,21 @@ +error[E0416]: identifier `x` is bound more than once in the same pattern + --> $DIR/issue-3038.rs:12:15 + | +LL | F::G(x, x) => { println!("{}", x + x); } + | ^ used in a pattern more than once + +error[E0416]: identifier `x` is bound more than once in the same pattern + --> $DIR/issue-3038.rs:17:32 + | +LL | H::I(J::L(x, _), K::M(_, x)) + | ^ used in a pattern more than once + +error[E0416]: identifier `x` is bound more than once in the same pattern + --> $DIR/issue-3038.rs:23:13 + | +LL | (x, x) => { x } + | ^ used in a pattern more than once + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0416`. diff --git a/tests/ui/issues/issue-30380.rs b/tests/ui/issues/issue-30380.rs new file mode 100644 index 000000000..48b329c5d --- /dev/null +++ b/tests/ui/issues/issue-30380.rs @@ -0,0 +1,36 @@ +// check that panics in destructors during assignment do not leave +// destroyed values lying around for other destructors to observe. + +// run-fail +// error-pattern:panicking destructors ftw! +// ignore-emscripten no processes + +struct Observer<'a>(&'a mut FilledOnDrop); + +struct FilledOnDrop(u32); +impl Drop for FilledOnDrop { + fn drop(&mut self) { + if self.0 == 0 { + // this is only set during the destructor - safe + // code should not be able to observe this. + self.0 = 0x1c1c1c1c; + panic!("panicking destructors ftw!"); + } + } +} + +impl<'a> Drop for Observer<'a> { + fn drop(&mut self) { + assert_eq!(self.0 .0, 1); + } +} + +fn foo(b: &mut Observer) { + *b.0 = FilledOnDrop(1); +} + +fn main() { + let mut bomb = FilledOnDrop(0); + let mut observer = Observer(&mut bomb); + foo(&mut observer); +} diff --git a/tests/ui/issues/issue-30438-a.rs b/tests/ui/issues/issue-30438-a.rs new file mode 100644 index 000000000..0d4eb796a --- /dev/null +++ b/tests/ui/issues/issue-30438-a.rs @@ -0,0 +1,23 @@ +// Original regression test for Issue #30438. + +use std::ops::Index; + +struct Test<'a> { + s: &'a String +} + +impl <'a> Index<usize> for Test<'a> { + type Output = Test<'a>; + fn index(&self, _: usize) -> &Self::Output { + return &Test { s: &self.s}; + //~^ ERROR: cannot return reference to temporary value + } +} + +fn main() { + let s = "Hello World".to_string(); + let test = Test{s: &s}; + let r = &test[0]; + println!("{}", test.s); // OK since test is valid + println!("{}", r.s); // Segfault since value pointed by r has already been dropped +} diff --git a/tests/ui/issues/issue-30438-a.stderr b/tests/ui/issues/issue-30438-a.stderr new file mode 100644 index 000000000..53845af82 --- /dev/null +++ b/tests/ui/issues/issue-30438-a.stderr @@ -0,0 +1,12 @@ +error[E0515]: cannot return reference to temporary value + --> $DIR/issue-30438-a.rs:12:16 + | +LL | return &Test { s: &self.s}; + | ^------------------ + | || + | |temporary value created here + | returns a reference to data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-30438-b.rs b/tests/ui/issues/issue-30438-b.rs new file mode 100644 index 000000000..79510cdb6 --- /dev/null +++ b/tests/ui/issues/issue-30438-b.rs @@ -0,0 +1,24 @@ +// Modified regression test for Issue #30438 that exposed an +// independent issue (see discussion on ticket). + +use std::ops::Index; + +struct Test<'a> { + s: &'a String +} + +impl <'a> Index<usize> for Test<'a> { + type Output = Test<'a>; + fn index(&self, _: usize) -> &Self::Output { + &Test { s: &self.s} + //~^ ERROR: cannot return reference to temporary value + } +} + +fn main() { + let s = "Hello World".to_string(); + let test = Test{s: &s}; + let r = &test[0]; + println!("{}", test.s); // OK since test is valid + println!("{}", r.s); // Segfault since value pointed by r has already been dropped +} diff --git a/tests/ui/issues/issue-30438-b.stderr b/tests/ui/issues/issue-30438-b.stderr new file mode 100644 index 000000000..fd6bd25b1 --- /dev/null +++ b/tests/ui/issues/issue-30438-b.stderr @@ -0,0 +1,12 @@ +error[E0515]: cannot return reference to temporary value + --> $DIR/issue-30438-b.rs:13:9 + | +LL | &Test { s: &self.s} + | ^------------------ + | || + | |temporary value created here + | returns a reference to data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-30438-c.rs b/tests/ui/issues/issue-30438-c.rs new file mode 100644 index 000000000..4cf634245 --- /dev/null +++ b/tests/ui/issues/issue-30438-c.rs @@ -0,0 +1,21 @@ +// Simplified regression test for #30438, inspired by arielb1. + +trait Trait { type Out; } + +struct Test<'a> { s: &'a str } + +fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static { + //~^ WARN unnecessary lifetime parameter `'z` + let x = Test { s: "this cannot last" }; + &x + //~^ ERROR: cannot return reference to local variable `x` +} + +impl<'b> Trait for Test<'b> { type Out = Test<'b>; } + +fn main() { + let orig = Test { s: "Hello World" }; + let r = silly(&orig); + println!("{}", orig.s); // OK since `orig` is valid + println!("{}", r.s); // Segfault (method does not return a sane value) +} diff --git a/tests/ui/issues/issue-30438-c.stderr b/tests/ui/issues/issue-30438-c.stderr new file mode 100644 index 000000000..a7a5c0500 --- /dev/null +++ b/tests/ui/issues/issue-30438-c.stderr @@ -0,0 +1,17 @@ +warning: unnecessary lifetime parameter `'z` + --> $DIR/issue-30438-c.rs:7:74 + | +LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static { + | ^^ + | + = help: you can use the `'static` lifetime directly, in place of `'z` + +error[E0515]: cannot return reference to local variable `x` + --> $DIR/issue-30438-c.rs:10:5 + | +LL | &x + | ^^ returns a reference to data owned by the current function + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-30490.rs b/tests/ui/issues/issue-30490.rs new file mode 100644 index 000000000..4f0eeac8f --- /dev/null +++ b/tests/ui/issues/issue-30490.rs @@ -0,0 +1,102 @@ +// run-pass +// ignore-emscripten no processes +// ignore-sgx no processes +// ignore-fuchsia Child I/O swaps not privileged + +// Previously libstd would set stdio descriptors of a child process +// by `dup`ing the requested descriptors to inherit directly into the +// stdio descriptors. This, however, would incorrectly handle cases +// where the descriptors to inherit were already stdio descriptors. +// This test checks to avoid that regression. + +#![cfg_attr(unix, feature(rustc_private))] +#![cfg_attr(not(unix), allow(unused_imports))] + +#[cfg(unix)] +extern crate libc; + +use std::fs::File; +use std::io::{Read, Write}; +use std::io::{stdout, stderr}; +use std::process::{Command, Stdio}; + +#[cfg(unix)] +use std::os::unix::io::FromRawFd; + +#[cfg(not(unix))] +fn main() { + // Bug not present in Windows +} + +#[cfg(unix)] +fn main() { + let mut args = std::env::args(); + let name = args.next().unwrap(); + let args: Vec<String> = args.collect(); + if let Some("--child") = args.get(0).map(|s| &**s) { + return child(); + } else if !args.is_empty() { + panic!("unknown options"); + } + + let stdout_backup = unsafe { libc::dup(libc::STDOUT_FILENO) }; + let stderr_backup = unsafe { libc::dup(libc::STDERR_FILENO) }; + assert!(stdout_backup > -1); + assert!(stderr_backup > -1); + + let (stdout_reader, stdout_writer) = pipe(); + let (stderr_reader, stderr_writer) = pipe(); + assert!(unsafe { libc::dup2(stdout_writer, libc::STDOUT_FILENO) } > -1); + assert!(unsafe { libc::dup2(stderr_writer, libc::STDERR_FILENO) } > -1); + + // Make sure we close any duplicates of the writer end of the pipe, + // otherwise we can get stuck reading from the pipe which has open + // writers but no one supplying any input + assert_eq!(unsafe { libc::close(stdout_writer) }, 0); + assert_eq!(unsafe { libc::close(stderr_writer) }, 0); + + stdout().write_all("parent stdout\n".as_bytes()).expect("failed to write to stdout"); + stderr().write_all("parent stderr\n".as_bytes()).expect("failed to write to stderr"); + + let child = { + Command::new(name) + .arg("--child") + .stdin(Stdio::inherit()) + .stdout(unsafe { Stdio::from_raw_fd(libc::STDERR_FILENO) }) + .stderr(unsafe { Stdio::from_raw_fd(libc::STDOUT_FILENO) }) + .spawn() + }; + + // The Stdio passed into the Command took over (and closed) std{out, err} + // so we should restore them as they were. + assert!(unsafe { libc::dup2(stdout_backup, libc::STDOUT_FILENO) } > -1); + assert!(unsafe { libc::dup2(stderr_backup, libc::STDERR_FILENO) } > -1); + + // Using File as a shim around the descriptor + let mut read = String::new(); + let mut f: File = unsafe { FromRawFd::from_raw_fd(stdout_reader) }; + f.read_to_string(&mut read).expect("failed to read from stdout file"); + assert_eq!(read, "parent stdout\nchild stderr\n"); + + // Using File as a shim around the descriptor + read.clear(); + let mut f: File = unsafe { FromRawFd::from_raw_fd(stderr_reader) }; + f.read_to_string(&mut read).expect("failed to read from stderr file"); + assert_eq!(read, "parent stderr\nchild stdout\n"); + + assert!(child.expect("failed to execute child process").wait().unwrap().success()); +} + +#[cfg(unix)] +fn child() { + stdout().write_all("child stdout\n".as_bytes()).expect("child failed to write to stdout"); + stderr().write_all("child stderr\n".as_bytes()).expect("child failed to write to stderr"); +} + +#[cfg(unix)] +/// Returns a pipe (reader, writer combo) +fn pipe() -> (i32, i32) { + let mut fds = [0; 2]; + assert_eq!(unsafe { libc::pipe(fds.as_mut_ptr()) }, 0); + (fds[0], fds[1]) +} diff --git a/tests/ui/issues/issue-3052.rs b/tests/ui/issues/issue-3052.rs new file mode 100644 index 000000000..ee2456da3 --- /dev/null +++ b/tests/ui/issues/issue-3052.rs @@ -0,0 +1,13 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +type Connection = Box<dyn FnMut(Vec<u8>) + 'static>; + +fn f() -> Option<Connection> { + let mock_connection: Connection = Box::new(|_| {}); + Some(mock_connection) +} + +pub fn main() { +} diff --git a/tests/ui/issues/issue-30530.rs b/tests/ui/issues/issue-30530.rs new file mode 100644 index 000000000..111fb8aa5 --- /dev/null +++ b/tests/ui/issues/issue-30530.rs @@ -0,0 +1,28 @@ +// run-pass +// Regression test for Issue #30530: alloca's created for storing +// intermediate scratch values during brace-less match arms need to be +// initialized with their drop-flag set to "dropped" (or else we end +// up running the destructors on garbage data at the end of the +// function). + +pub enum Handler { + Default, + #[allow(dead_code)] + Custom(*mut Box<dyn Fn()>), +} + +fn main() { + #[allow(unused_must_use)] { + take(Handler::Default, Box::new(main)); + } +} + +#[inline(never)] +pub fn take(h: Handler, f: Box<dyn Fn()>) -> Box<dyn Fn()> { + unsafe { + match h { + Handler::Custom(ptr) => *Box::from_raw(ptr), + Handler::Default => f, + } + } +} diff --git a/tests/ui/issues/issue-30589.rs b/tests/ui/issues/issue-30589.rs new file mode 100644 index 000000000..94eb58399 --- /dev/null +++ b/tests/ui/issues/issue-30589.rs @@ -0,0 +1,9 @@ +use std::fmt; + +impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Missing data: {}", self.0) + } +} +fn main() { +} diff --git a/tests/ui/issues/issue-30589.stderr b/tests/ui/issues/issue-30589.stderr new file mode 100644 index 000000000..4b88547a1 --- /dev/null +++ b/tests/ui/issues/issue-30589.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `DecoderError` in this scope + --> $DIR/issue-30589.rs:3:23 + | +LL | impl fmt::Display for DecoderError { + | ^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-30615.rs b/tests/ui/issues/issue-30615.rs new file mode 100644 index 000000000..c718449d8 --- /dev/null +++ b/tests/ui/issues/issue-30615.rs @@ -0,0 +1,5 @@ +// run-pass +fn main() { + &0u8 as *const u8 as *const dyn PartialEq<u8>; + &[0u8] as *const [u8; 1] as *const [u8]; +} diff --git a/tests/ui/issues/issue-30756.rs b/tests/ui/issues/issue-30756.rs new file mode 100644 index 000000000..836db951b --- /dev/null +++ b/tests/ui/issues/issue-30756.rs @@ -0,0 +1,7 @@ +// run-pass +#![forbid(unsafe_code)] + +thread_local!(static FOO: u8 = 1); + +fn main() { +} diff --git a/tests/ui/issues/issue-30891.rs b/tests/ui/issues/issue-30891.rs new file mode 100644 index 000000000..30f55e0bd --- /dev/null +++ b/tests/ui/issues/issue-30891.rs @@ -0,0 +1,10 @@ +// run-pass +const ERROR_CONST: bool = true; + +fn get() -> bool { + false || ERROR_CONST +} + +pub fn main() { + assert_eq!(get(), true); +} diff --git a/tests/ui/issues/issue-3091.rs b/tests/ui/issues/issue-3091.rs new file mode 100644 index 000000000..0c0a41242 --- /dev/null +++ b/tests/ui/issues/issue-3091.rs @@ -0,0 +1,7 @@ +// run-pass + +pub fn main() { + let x = 1; + let y = 1; + assert_eq!(&x, &y); +} diff --git a/tests/ui/issues/issue-3099-a.rs b/tests/ui/issues/issue-3099-a.rs new file mode 100644 index 000000000..9c3d8cf5a --- /dev/null +++ b/tests/ui/issues/issue-3099-a.rs @@ -0,0 +1,5 @@ +enum A { B, C } + +enum A { D, E } //~ ERROR the name `A` is defined multiple times + +fn main() {} diff --git a/tests/ui/issues/issue-3099-a.stderr b/tests/ui/issues/issue-3099-a.stderr new file mode 100644 index 000000000..e3733cebb --- /dev/null +++ b/tests/ui/issues/issue-3099-a.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `A` is defined multiple times + --> $DIR/issue-3099-a.rs:3:1 + | +LL | enum A { B, C } + | ------ previous definition of the type `A` here +LL | +LL | enum A { D, E } + | ^^^^^^ `A` redefined here + | + = note: `A` must be defined only once in the type namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-3099-b.rs b/tests/ui/issues/issue-3099-b.rs new file mode 100644 index 000000000..71952c3b0 --- /dev/null +++ b/tests/ui/issues/issue-3099-b.rs @@ -0,0 +1,5 @@ +pub mod a {} + +pub mod a {} //~ ERROR the name `a` is defined multiple times + +fn main() {} diff --git a/tests/ui/issues/issue-3099-b.stderr b/tests/ui/issues/issue-3099-b.stderr new file mode 100644 index 000000000..c0cfefeb9 --- /dev/null +++ b/tests/ui/issues/issue-3099-b.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `a` is defined multiple times + --> $DIR/issue-3099-b.rs:3:1 + | +LL | pub mod a {} + | --------- previous definition of the module `a` here +LL | +LL | pub mod a {} + | ^^^^^^^^^ `a` redefined here + | + = note: `a` must be defined only once in the type namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-3099.rs b/tests/ui/issues/issue-3099.rs new file mode 100644 index 000000000..ee75b3593 --- /dev/null +++ b/tests/ui/issues/issue-3099.rs @@ -0,0 +1,11 @@ +fn a(x: String) -> String { + format!("First function with {}", x) +} + +fn a(x: String, y: String) -> String { //~ ERROR the name `a` is defined multiple times + format!("Second function with {} and {}", x, y) +} + +fn main() { + println!("Result: "); +} diff --git a/tests/ui/issues/issue-3099.stderr b/tests/ui/issues/issue-3099.stderr new file mode 100644 index 000000000..32ee2e1d2 --- /dev/null +++ b/tests/ui/issues/issue-3099.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `a` is defined multiple times + --> $DIR/issue-3099.rs:5:1 + | +LL | fn a(x: String) -> String { + | ------------------------- previous definition of the value `a` here +... +LL | fn a(x: String, y: String) -> String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here + | + = note: `a` must be defined only once in the value namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-31011.rs b/tests/ui/issues/issue-31011.rs new file mode 100644 index 000000000..4dead04c2 --- /dev/null +++ b/tests/ui/issues/issue-31011.rs @@ -0,0 +1,29 @@ +macro_rules! log { + ( $ctx:expr, $( $args:expr),* ) => { + if $ctx.trace { + //~^ no field `trace` on type `&T` + println!( $( $args, )* ); + } + } +} + +// Create a structure. +struct Foo { + trace: bool, +} + +// Generic wrapper calls log! with a structure. +fn wrap<T>(context: &T) -> () +{ + log!(context, "entered wrapper"); + //~^ in this expansion of log! +} + +fn main() { + // Create a structure. + let x = Foo { trace: true }; + log!(x, "run started"); + // Apply a closure which accesses internal fields. + wrap(&x); + log!(x, "run finished"); +} diff --git a/tests/ui/issues/issue-31011.stderr b/tests/ui/issues/issue-31011.stderr new file mode 100644 index 000000000..58c170409 --- /dev/null +++ b/tests/ui/issues/issue-31011.stderr @@ -0,0 +1,17 @@ +error[E0609]: no field `trace` on type `&T` + --> $DIR/issue-31011.rs:3:17 + | +LL | if $ctx.trace { + | ^^^^^ +... +LL | fn wrap<T>(context: &T) -> () + | - type parameter 'T' declared here +LL | { +LL | log!(context, "entered wrapper"); + | -------------------------------- in this macro invocation + | + = note: this error originates in the macro `log` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-3109.rs b/tests/ui/issues/issue-3109.rs new file mode 100644 index 000000000..bd807cad7 --- /dev/null +++ b/tests/ui/issues/issue-3109.rs @@ -0,0 +1,4 @@ +// run-pass +pub fn main() { + println!("{:?}", ("hi there!", "you")); +} diff --git a/tests/ui/issues/issue-3121.rs b/tests/ui/issues/issue-3121.rs new file mode 100644 index 000000000..4bf5b9b60 --- /dev/null +++ b/tests/ui/issues/issue-3121.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +#[derive(Copy, Clone)] +enum side { mayo, catsup, vinegar } +#[derive(Copy, Clone)] +enum order { hamburger, fries(side), shake } +#[derive(Copy, Clone)] +enum meal { to_go(order), for_here(order) } + +fn foo(m: Box<meal>, cond: bool) { + match *m { + meal::to_go(_) => { } + meal::for_here(_) if cond => {} + meal::for_here(order::hamburger) => {} + meal::for_here(order::fries(_s)) => {} + meal::for_here(order::shake) => {} + } +} + +pub fn main() { + foo(Box::new(meal::for_here(order::hamburger)), true) +} diff --git a/tests/ui/issues/issue-31260.rs b/tests/ui/issues/issue-31260.rs new file mode 100644 index 000000000..4db7445b0 --- /dev/null +++ b/tests/ui/issues/issue-31260.rs @@ -0,0 +1,15 @@ +// check-pass +#![allow(dead_code)] +pub struct Struct<K: 'static> { + pub field: K, +} + +static STRUCT: Struct<&'static [u8]> = Struct { + field: {&[1]} +}; + +static STRUCT2: Struct<&'static [u8]> = Struct { + field: &[1] +}; + +fn main() {} diff --git a/tests/ui/issues/issue-31267-additional.rs b/tests/ui/issues/issue-31267-additional.rs new file mode 100644 index 000000000..7f0cbd658 --- /dev/null +++ b/tests/ui/issues/issue-31267-additional.rs @@ -0,0 +1,20 @@ +// run-pass + +#[derive(Clone, Copy, Debug)] +struct Bar; + +const BAZ: Bar = Bar; + +#[derive(Debug)] +struct Foo(#[allow(unused_tuple_struct_fields)] [Bar; 1]); + +struct Biz; + +impl Biz { + const BAZ: Foo = Foo([BAZ; 1]); +} + +fn main() { + let foo = Biz::BAZ; + println!("{:?}", foo); +} diff --git a/tests/ui/issues/issue-31267.rs b/tests/ui/issues/issue-31267.rs new file mode 100644 index 000000000..50843c89e --- /dev/null +++ b/tests/ui/issues/issue-31267.rs @@ -0,0 +1,14 @@ +// run-pass +// Regression test for issue #31267 + + +struct Foo; + +impl Foo { + const FOO: [i32; 3] = [0; 3]; +} + +pub fn main() { + let foo = Foo::FOO; + assert_eq!(foo, [0i32, 0, 0]); +} diff --git a/tests/ui/issues/issue-31299.rs b/tests/ui/issues/issue-31299.rs new file mode 100644 index 000000000..78c3252d3 --- /dev/null +++ b/tests/ui/issues/issue-31299.rs @@ -0,0 +1,35 @@ +// run-pass +// Regression test for #31299. This was generating an overflow error +// because of eager normalization: +// +// proving `M: Sized` requires +// - proving `PtrBack<Vec<M>>: Sized` requires +// - normalizing `Vec<<Vec<M> as Front>::Back>>: Sized` requires +// - proving `Vec<M>: Front` requires +// - `M: Sized` <-- cycle! +// +// If we skip the normalization step, though, everything goes fine. +// +// This could be fixed by implementing lazy normalization everywhere. +// +// However, we want this to work before then. For that, when checking +// whether a type is Sized we only check that the tails are Sized. As +// PtrBack does not have a tail, we don't need to normalize anything +// and this compiles + +trait Front { + type Back; +} + +impl<T> Front for Vec<T> { + type Back = Vec<T>; +} + +struct PtrBack<T: Front>(#[allow(unused_tuple_struct_fields)] Vec<T::Back>); + +struct M(#[allow(unused_tuple_struct_fields)] PtrBack<Vec<M>>); + +#[allow(unused_must_use)] +fn main() { + std::mem::size_of::<M>(); +} diff --git a/tests/ui/issues/issue-3136-b.rs b/tests/ui/issues/issue-3136-b.rs new file mode 100644 index 000000000..c4ca7236e --- /dev/null +++ b/tests/ui/issues/issue-3136-b.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-3136-a.rc + +// pretty-expanded FIXME #23616 + +extern crate issue_3136_a; + +pub fn main() {} diff --git a/tests/ui/issues/issue-3149.rs b/tests/ui/issues/issue-3149.rs new file mode 100644 index 000000000..6ab3bc846 --- /dev/null +++ b/tests/ui/issues/issue-3149.rs @@ -0,0 +1,26 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_snake_case)] +// pretty-expanded FIXME #23616 + +fn Matrix4<T>(m11: T, m12: T, m13: T, m14: T, + m21: T, m22: T, m23: T, m24: T, + m31: T, m32: T, m33: T, m34: T, + m41: T, m42: T, m43: T, m44: T) + -> Matrix4<T> { + Matrix4 { + m11: m11, m12: m12, m13: m13, m14: m14, + m21: m21, m22: m22, m23: m23, m24: m24, + m31: m31, m32: m32, m33: m33, m34: m34, + m41: m41, m42: m42, m43: m43, m44: m44 + } +} + +struct Matrix4<T> { + m11: T, m12: T, m13: T, m14: T, + m21: T, m22: T, m23: T, m24: T, + m31: T, m32: T, m33: T, m34: T, + m41: T, m42: T, m43: T, m44: T, +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-31511.rs b/tests/ui/issues/issue-31511.rs new file mode 100644 index 000000000..53fecb016 --- /dev/null +++ b/tests/ui/issues/issue-31511.rs @@ -0,0 +1,6 @@ +fn cast_thin_to_fat(x: *const ()) { + x as *const [u8]; + //~^ ERROR: cannot cast thin pointer `*const ()` to fat pointer `*const [u8]` +} + +fn main() {} diff --git a/tests/ui/issues/issue-31511.stderr b/tests/ui/issues/issue-31511.stderr new file mode 100644 index 000000000..cb2991809 --- /dev/null +++ b/tests/ui/issues/issue-31511.stderr @@ -0,0 +1,9 @@ +error[E0607]: cannot cast thin pointer `*const ()` to fat pointer `*const [u8]` + --> $DIR/issue-31511.rs:2:5 + | +LL | x as *const [u8]; + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0607`. diff --git a/tests/ui/issues/issue-3154.rs b/tests/ui/issues/issue-3154.rs new file mode 100644 index 000000000..91c7203c1 --- /dev/null +++ b/tests/ui/issues/issue-3154.rs @@ -0,0 +1,11 @@ +struct Thing<'a, Q:'a> { + x: &'a Q +} + +fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { + Thing { x: x } //~ ERROR explicit lifetime required in the type of `x` [E0621] +} + +fn main() { + thing(&()); +} diff --git a/tests/ui/issues/issue-3154.stderr b/tests/ui/issues/issue-3154.stderr new file mode 100644 index 000000000..da2af83ff --- /dev/null +++ b/tests/ui/issues/issue-3154.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `x` + --> $DIR/issue-3154.rs:6:5 + | +LL | fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { + | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q` +LL | Thing { x: x } + | ^^^^^^^^^^^^^^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/issues/issue-31702.rs b/tests/ui/issues/issue-31702.rs new file mode 100644 index 000000000..5b24eead3 --- /dev/null +++ b/tests/ui/issues/issue-31702.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-31702-1.rs +// aux-build:issue-31702-2.rs + +// this test is actually entirely in the linked library crates + +extern crate issue_31702_1; +extern crate issue_31702_2; + +fn main() {} diff --git a/tests/ui/issues/issue-31769.rs b/tests/ui/issues/issue-31769.rs new file mode 100644 index 000000000..f56c6ea56 --- /dev/null +++ b/tests/ui/issues/issue-31769.rs @@ -0,0 +1,4 @@ +fn main() { + #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure + #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to a struct, enum, or union +} diff --git a/tests/ui/issues/issue-31769.stderr b/tests/ui/issues/issue-31769.stderr new file mode 100644 index 000000000..03e2f931c --- /dev/null +++ b/tests/ui/issues/issue-31769.stderr @@ -0,0 +1,16 @@ +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-31769.rs:2:5 + | +LL | #[inline] struct Foo; + | ^^^^^^^^^ ----------- not a function or closure + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-31769.rs:3:12 + | +LL | #[repr(C)] fn foo() {} + | ^ ----------- not a struct, enum, or union + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0517, E0518. +For more information about an error, try `rustc --explain E0517`. diff --git a/tests/ui/issues/issue-31776.rs b/tests/ui/issues/issue-31776.rs new file mode 100644 index 000000000..c86623ce2 --- /dev/null +++ b/tests/ui/issues/issue-31776.rs @@ -0,0 +1,55 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +// Various scenarios in which `pub` is required in blocks + +struct S; + +mod m { + fn f() { + impl ::S { + pub fn s(&self) {} + } + } +} + +// Scenario 1 + +pub trait Tr { + type A; +} +pub struct S1; + +fn f() { + pub struct Z; + + impl ::Tr for ::S1 { + type A = Z; // Private-in-public error unless `struct Z` is pub + } +} + +// Scenario 2 + +trait Tr1 { + type A; + fn pull(&self) -> Self::A; +} +struct S2; + +mod m1 { + fn f() { + pub struct Z { + pub field: u8 + } + + impl ::Tr1 for ::S2 { + type A = Z; + fn pull(&self) -> Self::A { Z{field: 10} } + } + } +} + +fn main() { + S.s(); // Privacy error, unless `fn s` is pub + let a = S2.pull().field; // Privacy error unless `field: u8` is pub +} diff --git a/tests/ui/issues/issue-31910.rs b/tests/ui/issues/issue-31910.rs new file mode 100644 index 000000000..e0655d3f6 --- /dev/null +++ b/tests/ui/issues/issue-31910.rs @@ -0,0 +1,11 @@ +enum Enum<T: Trait> { + X = Trait::Number, + //~^ ERROR mismatched types + //~| expected `isize`, found `i32` +} + +trait Trait { + const Number: i32 = 1; +} + +fn main() {} diff --git a/tests/ui/issues/issue-31910.stderr b/tests/ui/issues/issue-31910.stderr new file mode 100644 index 000000000..2603c9442 --- /dev/null +++ b/tests/ui/issues/issue-31910.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/issue-31910.rs:2:9 + | +LL | X = Trait::Number, + | ^^^^^^^^^^^^^ expected `isize`, found `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-32004.rs b/tests/ui/issues/issue-32004.rs new file mode 100644 index 000000000..b3493508c --- /dev/null +++ b/tests/ui/issues/issue-32004.rs @@ -0,0 +1,19 @@ +enum Foo { + Bar(i32), + Baz +} + +struct S; + +fn main() { + match Foo::Baz { + Foo::Bar => {} + //~^ ERROR expected unit struct, unit variant or constant, found tuple variant `Foo::Bar` + _ => {} + } + + match S { + S(()) => {} + //~^ ERROR expected tuple struct or tuple variant, found unit struct `S` + } +} diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr new file mode 100644 index 000000000..2d2ed5a63 --- /dev/null +++ b/tests/ui/issues/issue-32004.stderr @@ -0,0 +1,32 @@ +error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Foo::Bar` + --> $DIR/issue-32004.rs:10:9 + | +LL | Bar(i32), + | -------- `Foo::Bar` defined here +LL | Baz + | --- similarly named unit variant `Baz` defined here +... +LL | Foo::Bar => {} + | ^^^^^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | Foo::Bar(_) => {} + | ~~~~~~~~~~~ +help: a unit variant with a similar name exists + | +LL | Foo::Baz => {} + | ~~~ + +error[E0532]: expected tuple struct or tuple variant, found unit struct `S` + --> $DIR/issue-32004.rs:16:9 + | +LL | struct S; + | --------- `S` defined here +... +LL | S(()) => {} + | ^^^^^ help: use this syntax instead: `S` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/issues/issue-32008.rs b/tests/ui/issues/issue-32008.rs new file mode 100644 index 000000000..6c2e20679 --- /dev/null +++ b/tests/ui/issues/issue-32008.rs @@ -0,0 +1,28 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +// Tests that binary operators allow subtyping on both the LHS and RHS, +// and as such do not introduce unnecessarily strict lifetime constraints. + +use std::ops::Add; + +struct Foo; + +impl<'a> Add<&'a Foo> for &'a Foo { + type Output = (); + fn add(self, rhs: &'a Foo) {} +} + +fn try_to_add(input: &Foo) { + let local = Foo; + + // Manual reborrow worked even with invariant trait search. + &*input + &local; + + // Direct use of the reference on the LHS requires additional + // subtyping before searching (invariantly) for `LHS: Add<RHS>`. + input + &local; +} + +fn main() { +} diff --git a/tests/ui/issues/issue-32086.rs b/tests/ui/issues/issue-32086.rs new file mode 100644 index 000000000..d595d1dd7 --- /dev/null +++ b/tests/ui/issues/issue-32086.rs @@ -0,0 +1,7 @@ +struct S(u8); +const C: S = S(10); + +fn main() { + let C(a) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C` + let C(..) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C` +} diff --git a/tests/ui/issues/issue-32086.stderr b/tests/ui/issues/issue-32086.stderr new file mode 100644 index 000000000..e566dea89 --- /dev/null +++ b/tests/ui/issues/issue-32086.stderr @@ -0,0 +1,21 @@ +error[E0532]: expected tuple struct or tuple variant, found constant `C` + --> $DIR/issue-32086.rs:5:9 + | +LL | struct S(u8); + | ------------- similarly named tuple struct `S` defined here +... +LL | let C(a) = S(11); + | ^ help: a tuple struct with a similar name exists: `S` + +error[E0532]: expected tuple struct or tuple variant, found constant `C` + --> $DIR/issue-32086.rs:6:9 + | +LL | struct S(u8); + | ------------- similarly named tuple struct `S` defined here +... +LL | let C(..) = S(11); + | ^ help: a tuple struct with a similar name exists: `S` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/issues/issue-32122-1.fixed b/tests/ui/issues/issue-32122-1.fixed new file mode 100644 index 000000000..4fc5f64ff --- /dev/null +++ b/tests/ui/issues/issue-32122-1.fixed @@ -0,0 +1,17 @@ +// run-rustfix +use std::ops::Deref; + +struct Foo(u8); + +impl Deref for Foo { + type Target = u8; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +fn main() { + let a = Foo(0); + // Should suggest `&*` when coercing &ty to *const ty + let _: *const u8 = &*a; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-32122-1.rs b/tests/ui/issues/issue-32122-1.rs new file mode 100644 index 000000000..3c4859f07 --- /dev/null +++ b/tests/ui/issues/issue-32122-1.rs @@ -0,0 +1,17 @@ +// run-rustfix +use std::ops::Deref; + +struct Foo(u8); + +impl Deref for Foo { + type Target = u8; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +fn main() { + let a = Foo(0); + // Should suggest `&*` when coercing &ty to *const ty + let _: *const u8 = &a; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-32122-1.stderr b/tests/ui/issues/issue-32122-1.stderr new file mode 100644 index 000000000..10b0c0967 --- /dev/null +++ b/tests/ui/issues/issue-32122-1.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-32122-1.rs:16:24 + | +LL | let _: *const u8 = &a; + | --------- ^^ expected `u8`, found struct `Foo` + | | + | expected due to this + | + = note: expected raw pointer `*const u8` + found reference `&Foo` +help: consider dereferencing + | +LL | let _: *const u8 = &*a; + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-32122-2.fixed b/tests/ui/issues/issue-32122-2.fixed new file mode 100644 index 000000000..cee0e5929 --- /dev/null +++ b/tests/ui/issues/issue-32122-2.fixed @@ -0,0 +1,28 @@ +// run-rustfix +use std::ops::Deref; +struct Bar(u8); +struct Foo(Bar); +struct Emm(Foo); +impl Deref for Bar{ + type Target = u8; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Foo { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Emm { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +fn main() { + let a = Emm(Foo(Bar(0))); + // Should suggest `&***` even when deref is pretty deep + let _: *const u8 = &***a; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-32122-2.rs b/tests/ui/issues/issue-32122-2.rs new file mode 100644 index 000000000..39e9df422 --- /dev/null +++ b/tests/ui/issues/issue-32122-2.rs @@ -0,0 +1,28 @@ +// run-rustfix +use std::ops::Deref; +struct Bar(u8); +struct Foo(Bar); +struct Emm(Foo); +impl Deref for Bar{ + type Target = u8; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Foo { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Emm { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +fn main() { + let a = Emm(Foo(Bar(0))); + // Should suggest `&***` even when deref is pretty deep + let _: *const u8 = &a; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-32122-2.stderr b/tests/ui/issues/issue-32122-2.stderr new file mode 100644 index 000000000..5c3dade8e --- /dev/null +++ b/tests/ui/issues/issue-32122-2.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-32122-2.rs:27:24 + | +LL | let _: *const u8 = &a; + | --------- ^^ expected `u8`, found struct `Emm` + | | + | expected due to this + | + = note: expected raw pointer `*const u8` + found reference `&Emm` +help: consider dereferencing + | +LL | let _: *const u8 = &***a; + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-3214.rs b/tests/ui/issues/issue-3214.rs new file mode 100644 index 000000000..928a65938 --- /dev/null +++ b/tests/ui/issues/issue-3214.rs @@ -0,0 +1,11 @@ +fn foo<T>() { + struct Foo { + x: T, //~ ERROR can't use generic parameters from outer function + } + + impl<T> Drop for Foo<T> { + //~^ ERROR this struct takes 0 generic arguments but 1 generic argument + fn drop(&mut self) {} + } +} +fn main() {} diff --git a/tests/ui/issues/issue-3214.stderr b/tests/ui/issues/issue-3214.stderr new file mode 100644 index 000000000..aa0b5ce64 --- /dev/null +++ b/tests/ui/issues/issue-3214.stderr @@ -0,0 +1,28 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/issue-3214.rs:3:12 + | +LL | fn foo<T>() { + | - type parameter from outer function +LL | struct Foo { + | - help: try using a local generic parameter instead: `<T>` +LL | x: T, + | ^ use of generic parameter from outer function + +error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-3214.rs:6:22 + | +LL | impl<T> Drop for Foo<T> { + | ^^^--- help: remove these generics + | | + | expected 0 generic arguments + | +note: struct defined here, with 0 generic parameters + --> $DIR/issue-3214.rs:2:12 + | +LL | struct Foo { + | ^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0107, E0401. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-3220.rs b/tests/ui/issues/issue-3220.rs new file mode 100644 index 000000000..7dc672edb --- /dev/null +++ b/tests/ui/issues/issue-3220.rs @@ -0,0 +1,25 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +// pretty-expanded FIXME #23616 + +struct thing { x: isize, } + +impl Drop for thing { + fn drop(&mut self) {} +} + +fn thing() -> thing { + thing { + x: 0 + } +} + +impl thing { + pub fn f(self) {} +} + +pub fn main() { + let z = thing(); + (z).f(); +} diff --git a/tests/ui/issues/issue-32292.rs b/tests/ui/issues/issue-32292.rs new file mode 100644 index 000000000..99b865391 --- /dev/null +++ b/tests/ui/issues/issue-32292.rs @@ -0,0 +1,9 @@ +// run-pass +#![deny(warnings)] + +#[derive(Hash, Ord, PartialOrd, Eq, PartialEq, Debug, Clone, Copy)] +struct Foo; + +fn main() { + let _ = Foo; +} diff --git a/tests/ui/issues/issue-32323.rs b/tests/ui/issues/issue-32323.rs new file mode 100644 index 000000000..5078f5523 --- /dev/null +++ b/tests/ui/issues/issue-32323.rs @@ -0,0 +1,8 @@ +pub trait Tr<'a> { + type Out; +} + +pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {} +//~^ ERROR mismatched types + +pub fn main() {} diff --git a/tests/ui/issues/issue-32323.stderr b/tests/ui/issues/issue-32323.stderr new file mode 100644 index 000000000..8212c607e --- /dev/null +++ b/tests/ui/issues/issue-32323.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-32323.rs:5:30 + | +LL | pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {} + | - ^^^^^^^^^^^^^^^^^^ expected associated type, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | + = note: expected associated type `<T as Tr<'a>>::Out` + found unit type `()` +help: consider constraining the associated type `<T as Tr<'a>>::Out` to `()` + | +LL | pub fn f<'a, T: Tr<'a, Out = ()>>() -> <T as Tr<'a>>::Out {} + | ++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-32324.rs b/tests/ui/issues/issue-32324.rs new file mode 100644 index 000000000..2df547b2e --- /dev/null +++ b/tests/ui/issues/issue-32324.rs @@ -0,0 +1,24 @@ +// check-pass +#![allow(dead_code)] + +trait Resources { + type Buffer: Copy; +} + +#[derive(Copy, Clone)] +struct ConstantBufferSet<R: Resources>( + pub R::Buffer +); + +#[derive(Copy, Clone)] +enum It {} +impl Resources for It { + type Buffer = u8; +} + +#[derive(Copy, Clone)] +enum Command { + BindConstantBuffers(ConstantBufferSet<It>) +} + +fn main() {} diff --git a/tests/ui/issues/issue-32326.rs b/tests/ui/issues/issue-32326.rs new file mode 100644 index 000000000..e928c66e2 --- /dev/null +++ b/tests/ui/issues/issue-32326.rs @@ -0,0 +1,10 @@ +// Regression test for #32326. We ran out of memory because we +// attempted to expand this case up to the recursion limit, and 2^N is +// too big. + +enum Expr { //~ ERROR E0072 + Plus(Expr, Expr), + Literal(i64), +} + +fn main() { } diff --git a/tests/ui/issues/issue-32326.stderr b/tests/ui/issues/issue-32326.stderr new file mode 100644 index 000000000..dc51198d9 --- /dev/null +++ b/tests/ui/issues/issue-32326.stderr @@ -0,0 +1,16 @@ +error[E0072]: recursive type `Expr` has infinite size + --> $DIR/issue-32326.rs:5:1 + | +LL | enum Expr { + | ^^^^^^^^^ +LL | Plus(Expr, Expr), + | ---- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | Plus(Box<Expr>, Expr), + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-32377.rs b/tests/ui/issues/issue-32377.rs new file mode 100644 index 000000000..555f6abd7 --- /dev/null +++ b/tests/ui/issues/issue-32377.rs @@ -0,0 +1,19 @@ +// normalize-stderr-test "\d+ bits" -> "N bits" + +use std::mem; +use std::marker::PhantomData; + +trait Foo { + type Error; +} + +struct Bar<U: Foo> { + stream: PhantomData<U::Error>, +} + +fn foo<U: Foo>(x: [usize; 2]) -> Bar<U> { + unsafe { mem::transmute(x) } + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types +} + +fn main() {} diff --git a/tests/ui/issues/issue-32377.stderr b/tests/ui/issues/issue-32377.stderr new file mode 100644 index 000000000..5e870eb3e --- /dev/null +++ b/tests/ui/issues/issue-32377.stderr @@ -0,0 +1,12 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-32377.rs:15:14 + | +LL | unsafe { mem::transmute(x) } + | ^^^^^^^^^^^^^^ + | + = note: source type: `[usize; 2]` (N bits) + = note: target type: `Bar<U>` (N bits) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/issues/issue-32389.rs b/tests/ui/issues/issue-32389.rs new file mode 100644 index 000000000..cc94cc819 --- /dev/null +++ b/tests/ui/issues/issue-32389.rs @@ -0,0 +1,11 @@ +// run-pass +fn foo<T>() -> T { loop {} } + +fn test() { + let ref mut a: &mut dyn FnMut((i8,), i16) = foo(); + a((0,), 0); +} + +fn main() { + let _ = test; +} diff --git a/tests/ui/issues/issue-32518.rs b/tests/ui/issues/issue-32518.rs new file mode 100644 index 000000000..808b40f71 --- /dev/null +++ b/tests/ui/issues/issue-32518.rs @@ -0,0 +1,13 @@ +// run-pass +// no-prefer-dynamic +// aux-build:cgu_test.rs +// aux-build:cgu_test_a.rs +// aux-build:cgu_test_b.rs + +extern crate cgu_test_a; +extern crate cgu_test_b; + +fn main() { + cgu_test_a::a::a(); + cgu_test_b::a::a(); +} diff --git a/tests/ui/issues/issue-32655.rs b/tests/ui/issues/issue-32655.rs new file mode 100644 index 000000000..f52e09231 --- /dev/null +++ b/tests/ui/issues/issue-32655.rs @@ -0,0 +1,19 @@ +macro_rules! foo ( + () => ( + #[derive_Clone] //~ ERROR cannot find attribute `derive_Clone` in this scope + struct T; + ); +); + +macro_rules! bar ( + ($e:item) => ($e) +); + +foo!(); + +bar!( + #[derive_Clone] //~ ERROR cannot find attribute `derive_Clone` in this scope + struct S; +); + +fn main() {} diff --git a/tests/ui/issues/issue-32655.stderr b/tests/ui/issues/issue-32655.stderr new file mode 100644 index 000000000..b8362499b --- /dev/null +++ b/tests/ui/issues/issue-32655.stderr @@ -0,0 +1,25 @@ +error: cannot find attribute `derive_Clone` in this scope + --> $DIR/issue-32655.rs:3:11 + | +LL | #[derive_Clone] + | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` +... +LL | foo!(); + | ------ in this macro invocation + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL + | + = note: similarly named attribute macro `derive_const` defined here + | + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: cannot find attribute `derive_Clone` in this scope + --> $DIR/issue-32655.rs:15:7 + | +LL | #[derive_Clone] + | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL + | + = note: similarly named attribute macro `derive_const` defined here + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-32709.rs b/tests/ui/issues/issue-32709.rs new file mode 100644 index 000000000..c05bfdc4c --- /dev/null +++ b/tests/ui/issues/issue-32709.rs @@ -0,0 +1,8 @@ +// Make sure that the span of try shorthand does not include the trailing +// semicolon; +fn a() -> Result<i32, ()> { + Err(5)?; //~ ERROR + Ok(1) +} + +fn main() {} diff --git a/tests/ui/issues/issue-32709.stderr b/tests/ui/issues/issue-32709.stderr new file mode 100644 index 000000000..1d595ca56 --- /dev/null +++ b/tests/ui/issues/issue-32709.stderr @@ -0,0 +1,17 @@ +error[E0277]: `?` couldn't convert the error to `()` + --> $DIR/issue-32709.rs:4:11 + | +LL | fn a() -> Result<i32, ()> { + | --------------- expected `()` because of this +LL | Err(5)?; + | ^ the trait `From<{integer}>` is not implemented for `()` + | + = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait + = help: the following other types implement trait `FromResidual<R>`: + <Result<T, F> as FromResidual<Result<Infallible, E>>> + <Result<T, F> as FromResidual<Yeet<E>>> + = note: required for `Result<i32, ()>` to implement `FromResidual<Result<Infallible, {integer}>>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-32782.rs b/tests/ui/issues/issue-32782.rs new file mode 100644 index 000000000..e3aa9f3bf --- /dev/null +++ b/tests/ui/issues/issue-32782.rs @@ -0,0 +1,13 @@ +macro_rules! bar ( + () => () +); + +macro_rules! foo ( + () => ( + #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps + bar!(); + ); +); + +foo!(); +fn main() {} diff --git a/tests/ui/issues/issue-32782.stderr b/tests/ui/issues/issue-32782.stderr new file mode 100644 index 000000000..a6c55ba03 --- /dev/null +++ b/tests/ui/issues/issue-32782.stderr @@ -0,0 +1,15 @@ +error[E0658]: allow_internal_unstable side-steps feature gating and stability checks + --> $DIR/issue-32782.rs:7:9 + | +LL | #[allow_internal_unstable] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | foo!(); + | ------ in this macro invocation + | + = help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-32797.rs b/tests/ui/issues/issue-32797.rs new file mode 100644 index 000000000..b12b929f8 --- /dev/null +++ b/tests/ui/issues/issue-32797.rs @@ -0,0 +1,13 @@ +// check-pass + +pub use bar::*; +mod bar { + pub use super::*; +} + +pub use baz::*; +mod baz { + pub use main as f; +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-32805.rs b/tests/ui/issues/issue-32805.rs new file mode 100644 index 000000000..23c194739 --- /dev/null +++ b/tests/ui/issues/issue-32805.rs @@ -0,0 +1,10 @@ +// run-pass +fn const_mir() -> f32 { 9007199791611905.0 } + +fn main() { + let original = "9007199791611905.0"; // (1<<53)+(1<<29)+1 + let expected = "9007200000000000"; + + assert_eq!(const_mir().to_string(), expected); + assert_eq!(original.parse::<f32>().unwrap().to_string(), expected); +} diff --git a/tests/ui/issues/issue-3290.rs b/tests/ui/issues/issue-3290.rs new file mode 100644 index 000000000..7014d517f --- /dev/null +++ b/tests/ui/issues/issue-3290.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(dead_code)] + +pub fn main() { + let mut x: Box<_> = Box::new(3); + x = x; + assert_eq!(*x, 3); +} diff --git a/tests/ui/issues/issue-32950.rs b/tests/ui/issues/issue-32950.rs new file mode 100644 index 000000000..27d68a11c --- /dev/null +++ b/tests/ui/issues/issue-32950.rs @@ -0,0 +1,9 @@ +#![feature(concat_idents)] + +#[derive(Debug)] +struct Baz<T>( + concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros + //~^ ERROR cannot find type `FooBar` in this scope +); + +fn main() {} diff --git a/tests/ui/issues/issue-32950.stderr b/tests/ui/issues/issue-32950.stderr new file mode 100644 index 000000000..f6635d982 --- /dev/null +++ b/tests/ui/issues/issue-32950.stderr @@ -0,0 +1,17 @@ +error: `derive` cannot be used on items with type macros + --> $DIR/issue-32950.rs:5:5 + | +LL | concat_idents!(Foo, Bar) + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0412]: cannot find type `FooBar` in this scope + --> $DIR/issue-32950.rs:5:5 + | +LL | concat_idents!(Foo, Bar) + | ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + | + = note: this error originates in the macro `concat_idents` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-32995-2.rs b/tests/ui/issues/issue-32995-2.rs new file mode 100644 index 000000000..e713a64d3 --- /dev/null +++ b/tests/ui/issues/issue-32995-2.rs @@ -0,0 +1,13 @@ +fn main() { + { fn f<X: ::std::marker()::Send>() {} } + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + + { fn f() -> impl ::std::marker()::Send { } } + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait +} + +#[derive(Clone)] +struct X; + +impl ::std::marker()::Copy for X {} +//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait diff --git a/tests/ui/issues/issue-32995-2.stderr b/tests/ui/issues/issue-32995-2.stderr new file mode 100644 index 000000000..6c2d772a2 --- /dev/null +++ b/tests/ui/issues/issue-32995-2.stderr @@ -0,0 +1,21 @@ +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995-2.rs:2:22 + | +LL | { fn f<X: ::std::marker()::Send>() {} } + | ^^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995-2.rs:5:29 + | +LL | { fn f() -> impl ::std::marker()::Send { } } + | ^^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995-2.rs:12:13 + | +LL | impl ::std::marker()::Copy for X {} + | ^^^^^^^^ only `Fn` traits may use parentheses + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0214`. diff --git a/tests/ui/issues/issue-32995.rs b/tests/ui/issues/issue-32995.rs new file mode 100644 index 000000000..0d07a7693 --- /dev/null +++ b/tests/ui/issues/issue-32995.rs @@ -0,0 +1,24 @@ +fn main() { + let x: usize() = 1; + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + + let b: ::std::boxed()::Box<_> = Box::new(1); + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + + let p = ::std::str::()::from_utf8(b"foo").unwrap(); + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + + let p = ::std::str::from_utf8::()(b"foo").unwrap(); + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + + let o : Box<dyn (::std::marker()::Send)> = Box::new(1); + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + + let o : Box<dyn Send + ::std::marker()::Sync> = Box::new(1); + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait +} + +fn foo<X:Default>() { + let d : X() = Default::default(); + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait +} diff --git a/tests/ui/issues/issue-32995.stderr b/tests/ui/issues/issue-32995.stderr new file mode 100644 index 000000000..b868011b9 --- /dev/null +++ b/tests/ui/issues/issue-32995.stderr @@ -0,0 +1,45 @@ +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:2:12 + | +LL | let x: usize() = 1; + | ^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:5:19 + | +LL | let b: ::std::boxed()::Box<_> = Box::new(1); + | ^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:8:20 + | +LL | let p = ::std::str::()::from_utf8(b"foo").unwrap(); + | ^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:11:25 + | +LL | let p = ::std::str::from_utf8::()(b"foo").unwrap(); + | ^^^^^^^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:14:29 + | +LL | let o : Box<dyn (::std::marker()::Send)> = Box::new(1); + | ^^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:17:35 + | +LL | let o : Box<dyn Send + ::std::marker()::Sync> = Box::new(1); + | ^^^^^^^^ only `Fn` traits may use parentheses + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:22:13 + | +LL | let d : X() = Default::default(); + | ^^^ only `Fn` traits may use parentheses + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0214`. diff --git a/tests/ui/issues/issue-33096.rs b/tests/ui/issues/issue-33096.rs new file mode 100644 index 000000000..2501e1430 --- /dev/null +++ b/tests/ui/issues/issue-33096.rs @@ -0,0 +1,19 @@ +// run-pass +// compile-flags: -g +// ignore-asmjs wasm2js does not support source maps yet + +use std::ops::Deref; + +trait Foo { + fn foo() {} +} + +impl Foo for u8 {} + +fn bar<T: Deref>() where T::Target: Foo { + <<T as Deref>::Target as Foo>::foo() +} + +fn main() { + bar::<&u8>(); +} diff --git a/tests/ui/issues/issue-33187.rs b/tests/ui/issues/issue-33187.rs new file mode 100644 index 000000000..8db9e0058 --- /dev/null +++ b/tests/ui/issues/issue-33187.rs @@ -0,0 +1,23 @@ +// run-pass + +struct Foo<A: Repr>(<A as Repr>::Data); + +impl<A> Copy for Foo<A> where <A as Repr>::Data: Copy {} +impl<A> Clone for Foo<A> +where + <A as Repr>::Data: Clone, +{ + fn clone(&self) -> Self { + Foo(self.0.clone()) + } +} + +trait Repr { + type Data; +} + +impl<A> Repr for A { + type Data = u32; +} + +fn main() {} diff --git a/tests/ui/issues/issue-33202.rs b/tests/ui/issues/issue-33202.rs new file mode 100644 index 000000000..11b89ae1b --- /dev/null +++ b/tests/ui/issues/issue-33202.rs @@ -0,0 +1,9 @@ +// run-pass +#[repr(C)] +pub enum CPOption<T> { + PSome(T), +} + +fn main() { + println!("sizeof CPOption<i32> {}", std::mem::size_of::<CPOption<i32>>()); +} diff --git a/tests/ui/issues/issue-33241.rs b/tests/ui/issues/issue-33241.rs new file mode 100644 index 000000000..5f9f1e4a7 --- /dev/null +++ b/tests/ui/issues/issue-33241.rs @@ -0,0 +1,12 @@ +// check-pass + +use std::fmt; + +// CoerceUnsized is not implemented for tuples. You can still create +// an unsized tuple by transmuting a trait object. +fn any<T>() -> T { unreachable!() } + +fn main() { + let t: &(u8, dyn fmt::Debug) = any(); + println!("{:?}", &t.1); +} diff --git a/tests/ui/issues/issue-33287.rs b/tests/ui/issues/issue-33287.rs new file mode 100644 index 000000000..770eb7c02 --- /dev/null +++ b/tests/ui/issues/issue-33287.rs @@ -0,0 +1,10 @@ +// build-pass +#![allow(dead_code)] +#![allow(unused_variables)] +const A: [u32; 1] = [0]; + +fn test() { + let range = A[1]..; +} + +fn main() { } diff --git a/tests/ui/issues/issue-33293.rs b/tests/ui/issues/issue-33293.rs new file mode 100644 index 000000000..a6ef007d5 --- /dev/null +++ b/tests/ui/issues/issue-33293.rs @@ -0,0 +1,6 @@ +fn main() { + match 0 { + aaa::bbb(_) => () + //~^ ERROR failed to resolve: use of undeclared crate or module `aaa` + }; +} diff --git a/tests/ui/issues/issue-33293.stderr b/tests/ui/issues/issue-33293.stderr new file mode 100644 index 000000000..c8450f400 --- /dev/null +++ b/tests/ui/issues/issue-33293.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `aaa` + --> $DIR/issue-33293.rs:3:9 + | +LL | aaa::bbb(_) => () + | ^^^ use of undeclared crate or module `aaa` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/issues/issue-33387.rs b/tests/ui/issues/issue-33387.rs new file mode 100644 index 000000000..499fa7c1f --- /dev/null +++ b/tests/ui/issues/issue-33387.rs @@ -0,0 +1,32 @@ +// run-pass +#![feature(rustc_attrs)] + +use std::sync::Arc; + +trait Foo { + fn get(&self) -> [u8; 2]; +} + +impl Foo for [u8; 2] { + fn get(&self) -> [u8; 2] { + *self + } +} + +struct Bar<T: ?Sized>(T); + +fn unsize_fat_ptr<'a>(x: &'a Bar<dyn Foo + Send + 'a>) -> &'a Bar<dyn Foo + 'a> { + x +} + +fn unsize_nested_fat_ptr(x: Arc<dyn Foo + Send>) -> Arc<dyn Foo> { + x +} + +fn main() { + let x: Box<Bar<dyn Foo + Send>> = Box::new(Bar([1,2])); + assert_eq!(unsize_fat_ptr(&*x).0.get(), [1, 2]); + + let x: Arc<dyn Foo + Send> = Arc::new([3, 4]); + assert_eq!(unsize_nested_fat_ptr(x).get(), [3, 4]); +} diff --git a/tests/ui/issues/issue-3344.rs b/tests/ui/issues/issue-3344.rs new file mode 100644 index 000000000..de764b3d0 --- /dev/null +++ b/tests/ui/issues/issue-3344.rs @@ -0,0 +1,7 @@ +#[derive(PartialEq)] +struct Thing(usize); +impl PartialOrd for Thing { //~ ERROR not all trait items implemented, missing: `partial_cmp` + fn le(&self, other: &Thing) -> bool { true } + fn ge(&self, other: &Thing) -> bool { true } +} +fn main() {} diff --git a/tests/ui/issues/issue-3344.stderr b/tests/ui/issues/issue-3344.stderr new file mode 100644 index 000000000..11d599967 --- /dev/null +++ b/tests/ui/issues/issue-3344.stderr @@ -0,0 +1,11 @@ +error[E0046]: not all trait items implemented, missing: `partial_cmp` + --> $DIR/issue-3344.rs:3:1 + | +LL | impl PartialOrd for Thing { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `partial_cmp` in implementation + | + = help: implement the missing item: `fn partial_cmp(&self, _: &Rhs) -> Option<std::cmp::Ordering> { todo!() }` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/issues/issue-33461.rs b/tests/ui/issues/issue-33461.rs new file mode 100644 index 000000000..4e01d4d30 --- /dev/null +++ b/tests/ui/issues/issue-33461.rs @@ -0,0 +1,28 @@ +// run-pass +#![allow(unused_variables)] +use std::marker::PhantomData; + +struct TheType<T> { + t: PhantomData<T> +} + +pub trait TheTrait { + type TheAssociatedType; +} + +impl TheTrait for () { + type TheAssociatedType = (); +} + +pub trait Shape<P: TheTrait> { + fn doit(&self) { + } +} + +impl<P: TheTrait> Shape<P> for TheType<P::TheAssociatedType> { +} + +fn main() { + let ball = TheType { t: PhantomData }; + let handle: &dyn Shape<()> = &ball; +} diff --git a/tests/ui/issues/issue-33504.rs b/tests/ui/issues/issue-33504.rs new file mode 100644 index 000000000..89cc06ede --- /dev/null +++ b/tests/ui/issues/issue-33504.rs @@ -0,0 +1,9 @@ +// Shadowing a unit-like enum in a closure + +struct Test; + +fn main() { + || { + let Test = 1; //~ ERROR mismatched types + }; +} diff --git a/tests/ui/issues/issue-33504.stderr b/tests/ui/issues/issue-33504.stderr new file mode 100644 index 000000000..d9e7c3b16 --- /dev/null +++ b/tests/ui/issues/issue-33504.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/issue-33504.rs:7:13 + | +LL | struct Test; + | ----------- unit struct defined here +... +LL | let Test = 1; + | ^^^^ - this expression has type `{integer}` + | | + | expected integer, found struct `Test` + | `Test` is interpreted as a unit struct, not a new binding + | help: introduce a new binding instead: `other_test` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-33525.rs b/tests/ui/issues/issue-33525.rs new file mode 100644 index 000000000..74f21eff2 --- /dev/null +++ b/tests/ui/issues/issue-33525.rs @@ -0,0 +1,5 @@ +fn main() { + a; //~ ERROR cannot find value `a` + "".lorem; //~ ERROR no field + "".ipsum; //~ ERROR no field +} diff --git a/tests/ui/issues/issue-33525.stderr b/tests/ui/issues/issue-33525.stderr new file mode 100644 index 000000000..f8d703dc3 --- /dev/null +++ b/tests/ui/issues/issue-33525.stderr @@ -0,0 +1,22 @@ +error[E0425]: cannot find value `a` in this scope + --> $DIR/issue-33525.rs:2:5 + | +LL | a; + | ^ not found in this scope + +error[E0609]: no field `lorem` on type `&'static str` + --> $DIR/issue-33525.rs:3:8 + | +LL | "".lorem; + | ^^^^^ + +error[E0609]: no field `ipsum` on type `&'static str` + --> $DIR/issue-33525.rs:4:8 + | +LL | "".ipsum; + | ^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0425, E0609. +For more information about an error, try `rustc --explain E0425`. diff --git a/tests/ui/issues/issue-33571.rs b/tests/ui/issues/issue-33571.rs new file mode 100644 index 000000000..2713f47ad --- /dev/null +++ b/tests/ui/issues/issue-33571.rs @@ -0,0 +1,7 @@ +#[derive(Clone, + Sync, //~ ERROR cannot find derive macro `Sync` in this scope + //~| ERROR cannot find derive macro `Sync` in this scope + Copy)] +enum Foo {} + +fn main() {} diff --git a/tests/ui/issues/issue-33571.stderr b/tests/ui/issues/issue-33571.stderr new file mode 100644 index 000000000..2a9ba5ba7 --- /dev/null +++ b/tests/ui/issues/issue-33571.stderr @@ -0,0 +1,26 @@ +error: cannot find derive macro `Sync` in this scope + --> $DIR/issue-33571.rs:2:10 + | +LL | Sync, + | ^^^^ + | +note: unsafe traits like `Sync` should be implemented explicitly + --> $DIR/issue-33571.rs:2:10 + | +LL | Sync, + | ^^^^ + +error: cannot find derive macro `Sync` in this scope + --> $DIR/issue-33571.rs:2:10 + | +LL | Sync, + | ^^^^ + | +note: unsafe traits like `Sync` should be implemented explicitly + --> $DIR/issue-33571.rs:2:10 + | +LL | Sync, + | ^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-33687.rs b/tests/ui/issues/issue-33687.rs new file mode 100644 index 000000000..ac802ed86 --- /dev/null +++ b/tests/ui/issues/issue-33687.rs @@ -0,0 +1,17 @@ +// run-pass +#![feature(unboxed_closures)] +#![feature(fn_traits)] + +struct Test; + +impl FnOnce<(u32, u32)> for Test { + type Output = u32; + + extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { + a + b + } +} + +fn main() { + assert_eq!(Test(1u32, 2u32), 3u32); +} diff --git a/tests/ui/issues/issue-33770.rs b/tests/ui/issues/issue-33770.rs new file mode 100644 index 000000000..f3c99015b --- /dev/null +++ b/tests/ui/issues/issue-33770.rs @@ -0,0 +1,94 @@ +// run-pass +// ignore-emscripten no processes +// ignore-sgx no processes + +use std::process::{Command, Stdio}; +use std::env; +use std::sync::{Mutex, RwLock}; +use std::time::Duration; +use std::thread; + +fn test_mutex() { + let m = Mutex::new(0); + let _g = m.lock().unwrap(); + let _g2 = m.lock().unwrap(); +} + +fn test_try_mutex() { + let m = Mutex::new(0); + let _g = m.lock().unwrap(); + let _g2 = m.try_lock().unwrap(); +} + +fn test_rwlock_ww() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.write().unwrap(); +} + +fn test_try_rwlock_ww() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.try_write().unwrap(); +} + +fn test_rwlock_rw() { + let m = RwLock::new(0); + let _g = m.read().unwrap(); + let _g2 = m.write().unwrap(); +} + +fn test_try_rwlock_rw() { + let m = RwLock::new(0); + let _g = m.read().unwrap(); + let _g2 = m.try_write().unwrap(); +} + +fn test_rwlock_wr() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.read().unwrap(); +} + +fn test_try_rwlock_wr() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.try_read().unwrap(); +} + +fn main() { + let args: Vec<String> = env::args().collect(); + if args.len() > 1 { + match &*args[1] { + "mutex" => test_mutex(), + "try_mutex" => test_try_mutex(), + "rwlock_ww" => test_rwlock_ww(), + "try_rwlock_ww" => test_try_rwlock_ww(), + "rwlock_rw" => test_rwlock_rw(), + "try_rwlock_rw" => test_try_rwlock_rw(), + "rwlock_wr" => test_rwlock_wr(), + "try_rwlock_wr" => test_try_rwlock_wr(), + _ => unreachable!(), + } + // If we reach this point then the test failed + println!("TEST FAILED: {}", args[1]); + } else { + let mut v = vec![]; + v.push(Command::new(&args[0]).arg("mutex").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_mutex").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("rwlock_ww").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_rwlock_ww").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("rwlock_rw").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_rwlock_rw").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("rwlock_wr").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_rwlock_wr").stderr(Stdio::null()).spawn().unwrap()); + + thread::sleep(Duration::new(1, 0)); + + // Make sure all subprocesses either panicked or were killed because they deadlocked + for mut c in v { + c.kill().ok(); + assert!(!c.wait().unwrap().success()); + } + } +} diff --git a/tests/ui/issues/issue-3389.rs b/tests/ui/issues/issue-3389.rs new file mode 100644 index 000000000..294a07229 --- /dev/null +++ b/tests/ui/issues/issue-3389.rs @@ -0,0 +1,26 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +struct trie_node { + content: Vec<String> , + children: Vec<trie_node> , +} + +fn print_str_vector(vector: Vec<String> ) { + for string in &vector { + println!("{}", *string); + } +} + +pub fn main() { + let mut node: trie_node = trie_node { + content: Vec::new(), + children: Vec::new() + }; + let v = vec!["123".to_string(), "abc".to_string()]; + node.content = vec!["123".to_string(), "abc".to_string()]; + print_str_vector(v); + print_str_vector(node.content.clone()); + +} diff --git a/tests/ui/issues/issue-33903.rs b/tests/ui/issues/issue-33903.rs new file mode 100644 index 000000000..613aa121a --- /dev/null +++ b/tests/ui/issues/issue-33903.rs @@ -0,0 +1,10 @@ +// check-pass +#![allow(dead_code)] +// Issue 33903: +// Built-in indexing should be used even when the index is not +// trivially an integer +// Only built-in indexing can be used in constant expressions + +const FOO: i32 = [12, 34][0 + 1]; + +fn main() {} diff --git a/tests/ui/issues/issue-33941.rs b/tests/ui/issues/issue-33941.rs new file mode 100644 index 000000000..e3b6dcf55 --- /dev/null +++ b/tests/ui/issues/issue-33941.rs @@ -0,0 +1,9 @@ +// compile-flags: -Zdeduplicate-diagnostics=yes + +use std::collections::HashMap; + +fn main() { + for _ in HashMap::new().iter().cloned() {} //~ ERROR expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + //~^ ERROR expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + //~| ERROR expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` +} diff --git a/tests/ui/issues/issue-33941.stderr b/tests/ui/issues/issue-33941.stderr new file mode 100644 index 000000000..668eaabca --- /dev/null +++ b/tests/ui/issues/issue-33941.stderr @@ -0,0 +1,42 @@ +error[E0271]: expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + --> $DIR/issue-33941.rs:6:36 + | +LL | for _ in HashMap::new().iter().cloned() {} + | ^^^^^^ expected reference, found tuple + | + = note: expected reference `&_` + found tuple `(&_, &_)` +note: the method call chain might not have had the expected associated types + --> $DIR/issue-33941.rs:6:29 + | +LL | for _ in HashMap::new().iter().cloned() {} + | -------------- ^^^^^^ `Iterator::Item` is `(&_, &_)` here + | | + | this expression has type `HashMap<_, _>` +note: required by a bound in `cloned` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0271]: expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + --> $DIR/issue-33941.rs:6:14 + | +LL | for _ in HashMap::new().iter().cloned() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference + | + = note: expected tuple `(&_, &_)` + found reference `&_` + = note: required for `Cloned<std::collections::hash_map::Iter<'_, _, _>>` to implement `Iterator` + = note: required for `Cloned<std::collections::hash_map::Iter<'_, _, _>>` to implement `IntoIterator` + +error[E0271]: expected `Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + --> $DIR/issue-33941.rs:6:14 + | +LL | for _ in HashMap::new().iter().cloned() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference + | + = note: expected tuple `(&_, &_)` + found reference `&_` + = note: required for `Cloned<std::collections::hash_map::Iter<'_, _, _>>` to implement `Iterator` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/issues/issue-33992.rs b/tests/ui/issues/issue-33992.rs new file mode 100644 index 000000000..a6b137ba6 --- /dev/null +++ b/tests/ui/issues/issue-33992.rs @@ -0,0 +1,32 @@ +// run-pass +// ignore-windows +// ignore-macos +// ignore-emscripten common linkage not implemented right now + +#![feature(linkage)] + +#[linkage = "common"] +pub static mut TEST1: u32 = 0u32; + +#[linkage = "external"] +pub static TEST2: bool = true; + +#[linkage = "internal"] +pub static TEST3: bool = true; + +#[linkage = "linkonce"] +pub static TEST4: bool = true; + +#[linkage = "linkonce_odr"] +pub static TEST5: bool = true; + +#[linkage = "private"] +pub static TEST6: bool = true; + +#[linkage = "weak"] +pub static TEST7: bool = true; + +#[linkage = "weak_odr"] +pub static TEST8: bool = true; + +fn main() {} diff --git a/tests/ui/issues/issue-34047.rs b/tests/ui/issues/issue-34047.rs new file mode 100644 index 000000000..55196177f --- /dev/null +++ b/tests/ui/issues/issue-34047.rs @@ -0,0 +1,8 @@ +const C: u8 = 0; + +fn main() { + match 1u8 { + mut C => {} //~ ERROR match bindings cannot shadow constants + _ => {} + } +} diff --git a/tests/ui/issues/issue-34047.stderr b/tests/ui/issues/issue-34047.stderr new file mode 100644 index 000000000..f770ded50 --- /dev/null +++ b/tests/ui/issues/issue-34047.stderr @@ -0,0 +1,12 @@ +error[E0530]: match bindings cannot shadow constants + --> $DIR/issue-34047.rs:5:13 + | +LL | const C: u8 = 0; + | ---------------- the constant `C` is defined here +... +LL | mut C => {} + | ^ cannot be named the same as a constant + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0530`. diff --git a/tests/ui/issues/issue-34074.rs b/tests/ui/issues/issue-34074.rs new file mode 100644 index 000000000..0600d3937 --- /dev/null +++ b/tests/ui/issues/issue-34074.rs @@ -0,0 +1,10 @@ +// run-pass +// Make sure several unnamed function parameters don't conflict with each other + +trait Tr { + #[allow(anonymous_parameters)] + fn f(u8, u8) {} +} + +fn main() { +} diff --git a/tests/ui/issues/issue-34209.rs b/tests/ui/issues/issue-34209.rs new file mode 100644 index 000000000..632ddb91b --- /dev/null +++ b/tests/ui/issues/issue-34209.rs @@ -0,0 +1,11 @@ +enum S { + A, +} + +fn bug(l: S) { + match l { + S::B {} => {}, //~ ERROR no variant named `B` found for enum `S` + } +} + +fn main () {} diff --git a/tests/ui/issues/issue-34209.stderr b/tests/ui/issues/issue-34209.stderr new file mode 100644 index 000000000..f9a25b69f --- /dev/null +++ b/tests/ui/issues/issue-34209.stderr @@ -0,0 +1,12 @@ +error[E0599]: no variant named `B` found for enum `S` + --> $DIR/issue-34209.rs:7:12 + | +LL | enum S { + | ------ variant `B` not found here +... +LL | S::B {} => {}, + | ^ help: there is a variant with a similar name: `A` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-34229.rs b/tests/ui/issues/issue-34229.rs new file mode 100644 index 000000000..13e627a49 --- /dev/null +++ b/tests/ui/issues/issue-34229.rs @@ -0,0 +1,5 @@ +#[derive(PartialEq)] struct Comparable; +#[derive(PartialEq, PartialOrd)] struct Nope(Comparable); +//~^ ERROR can't compare `Comparable` + +fn main() {} diff --git a/tests/ui/issues/issue-34229.stderr b/tests/ui/issues/issue-34229.stderr new file mode 100644 index 000000000..69ef876d2 --- /dev/null +++ b/tests/ui/issues/issue-34229.stderr @@ -0,0 +1,18 @@ +error[E0277]: can't compare `Comparable` with `Comparable` + --> $DIR/issue-34229.rs:2:46 + | +LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); + | ---------- ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` + | | + | in this derive macro expansion + | + = help: the trait `PartialOrd` is not implemented for `Comparable` + = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `Comparable` with `#[derive(PartialOrd)]` + | +LL | #[derive(PartialEq)] #[derive(PartialOrd)] + | +++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-3424.rs b/tests/ui/issues/issue-3424.rs new file mode 100644 index 000000000..43d75a652 --- /dev/null +++ b/tests/ui/issues/issue-3424.rs @@ -0,0 +1,20 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +// rustc --test ignores2.rs && ./ignores2 + +pub struct Path; + +type rsrc_loader = Box<dyn FnMut(&Path) -> Result<String, String>>; + +fn tester() +{ + let mut loader: rsrc_loader = Box::new(move |_path| { + Ok("more blah".to_string()) + }); + + let path = Path; + assert!(loader(&path).is_ok()); +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-3429.rs b/tests/ui/issues/issue-3429.rs new file mode 100644 index 000000000..9d94c3ff6 --- /dev/null +++ b/tests/ui/issues/issue-3429.rs @@ -0,0 +1,8 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let x = 1_usize; + let y = || x; + let _z = y(); +} diff --git a/tests/ui/issues/issue-34334.rs b/tests/ui/issues/issue-34334.rs new file mode 100644 index 000000000..51486bc40 --- /dev/null +++ b/tests/ui/issues/issue-34334.rs @@ -0,0 +1,8 @@ +fn main () { + let sr: Vec<(u32, _, _) = vec![]; + //~^ ERROR expected one of + + let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); + //~^ ERROR a value of type `Vec<(u32, _, _)>` cannot be built + +} diff --git a/tests/ui/issues/issue-34334.stderr b/tests/ui/issues/issue-34334.stderr new file mode 100644 index 000000000..9d2c315e4 --- /dev/null +++ b/tests/ui/issues/issue-34334.stderr @@ -0,0 +1,38 @@ +error: expected one of `,`, `:`, or `>`, found `=` + --> $DIR/issue-34334.rs:2:29 + | +LL | let sr: Vec<(u32, _, _) = vec![]; + | -- - ^ expected one of `,`, `:`, or `>` + | | | + | | maybe try to close unmatched angle bracket + | while parsing the type for `sr` + | +help: you might have meant to end the type parameters here + | +LL | let sr: Vec<(u32, _, _)> = vec![]; + | + + +error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()` + --> $DIR/issue-34334.rs:5:87 + | +LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); + | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>` + | + = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` + = help: the trait `FromIterator<T>` is implemented for `Vec<T>` +note: the method call chain might not have had the expected associated types + --> $DIR/issue-34334.rs:5:43 + | +LL | let sr: Vec<(u32, _, _) = vec![]; + | ------ this expression has type `Vec<(_, _, _)>` +... +LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here + | | + | `Iterator::Item` is `&(_, _, _)` here +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-34349.rs b/tests/ui/issues/issue-34349.rs new file mode 100644 index 000000000..d86180261 --- /dev/null +++ b/tests/ui/issues/issue-34349.rs @@ -0,0 +1,22 @@ +// This is a regression test for a problem encountered around upvar +// inference and trait caching: in particular, we were entering a +// temporary closure kind during inference, and then caching results +// based on that temporary kind, which led to no error being reported +// in this particular test. + +fn main() { + let inc = || {}; + inc(); + + fn apply<F>(f: F) where F: Fn() { + f() + } + + let mut farewell = "goodbye".to_owned(); + let diary = || { //~ ERROR E0525 + farewell.push_str("!!!"); + println!("Then I screamed {}.", farewell); + }; + + apply(diary); +} diff --git a/tests/ui/issues/issue-34349.stderr b/tests/ui/issues/issue-34349.stderr new file mode 100644 index 000000000..8e9a16619 --- /dev/null +++ b/tests/ui/issues/issue-34349.stderr @@ -0,0 +1,22 @@ +error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` + --> $DIR/issue-34349.rs:16:17 + | +LL | let diary = || { + | ^^ this closure implements `FnMut`, not `Fn` +LL | farewell.push_str("!!!"); + | -------- closure is `FnMut` because it mutates the variable `farewell` here +... +LL | apply(diary); + | ----- ----- the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `apply` + --> $DIR/issue-34349.rs:11:32 + | +LL | fn apply<F>(f: F) where F: Fn() { + | ^^^^ required by this bound in `apply` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0525`. diff --git a/tests/ui/issues/issue-34373.rs b/tests/ui/issues/issue-34373.rs new file mode 100644 index 000000000..ca24e37d9 --- /dev/null +++ b/tests/ui/issues/issue-34373.rs @@ -0,0 +1,11 @@ +#![allow(warnings)] + +trait Trait<T> { + fn foo(_: T) {} +} + +pub struct Foo<T = Box<Trait<DefaultFoo>>>; //~ ERROR cycle detected +type DefaultFoo = Foo; + +fn main() { +} diff --git a/tests/ui/issues/issue-34373.stderr b/tests/ui/issues/issue-34373.stderr new file mode 100644 index 000000000..8be3cfa72 --- /dev/null +++ b/tests/ui/issues/issue-34373.stderr @@ -0,0 +1,27 @@ +error[E0391]: cycle detected when computing type of `Foo::T` + --> $DIR/issue-34373.rs:7:30 + | +LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>; + | ^^^^^^^^^^ + | +note: ...which requires expanding type alias `DefaultFoo`... + --> $DIR/issue-34373.rs:8:19 + | +LL | type DefaultFoo = Foo; + | ^^^ + = note: ...which again requires computing type of `Foo::T`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-34373.rs:1:1 + | +LL | / #![allow(warnings)] +LL | | +LL | | trait Trait<T> { +LL | | fn foo(_: T) {} +... | +LL | | fn main() { +LL | | } + | |_^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-34418.rs b/tests/ui/issues/issue-34418.rs new file mode 100644 index 000000000..6132f744b --- /dev/null +++ b/tests/ui/issues/issue-34418.rs @@ -0,0 +1,19 @@ +// check-pass + +macro_rules! make_item { + () => { fn f() {} } +} + +macro_rules! make_stmt { + () => { let x = 0; } +} + +fn f() { + make_item! {} +} + +fn g() { + make_stmt! {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-34427.rs b/tests/ui/issues/issue-34427.rs new file mode 100644 index 000000000..a14b5b9e2 --- /dev/null +++ b/tests/ui/issues/issue-34427.rs @@ -0,0 +1,17 @@ +// run-pass +// Issue #34427: On ARM, the code in `foo` at one time was generating +// a machine code instruction of the form: `str r0, [r0, rN]!` (for +// some N), which is not legal because the source register and base +// register cannot be identical in the preindexed form signalled by +// the `!`. +// +// See LLVM bug: https://llvm.org/bugs/show_bug.cgi?id=28809 + +#[inline(never)] +fn foo(n: usize) -> Vec<Option<(*mut (), &'static ())>> { + (0..n).map(|_| None).collect() +} + +fn main() { + let _ = (foo(10), foo(32)); +} diff --git a/tests/ui/issues/issue-3447.rs b/tests/ui/issues/issue-3447.rs new file mode 100644 index 000000000..ee5b22778 --- /dev/null +++ b/tests/ui/issues/issue-3447.rs @@ -0,0 +1,32 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_snake_case)] +#![allow(non_camel_case_types)] + +use std::cell::RefCell; + +static S: &'static str = "str"; + +struct list<T> { + element: T, + next: Option<Box<RefCell<list<T>>>> +} + +impl<T:'static> list<T> { + pub fn addEnd(&mut self, element: T) { + let newList = list { + element: element, + next: None + }; + + self.next = Some(Box::new(RefCell::new(newList))); + } +} + +pub fn main() { + let ls = list { + element: S, + next: None + }; + println!("{}", ls.element); +} diff --git a/tests/ui/issues/issue-34503.rs b/tests/ui/issues/issue-34503.rs new file mode 100644 index 000000000..26e735840 --- /dev/null +++ b/tests/ui/issues/issue-34503.rs @@ -0,0 +1,11 @@ +// run-pass +fn main() { + struct X; + trait Foo<T> { + fn foo(&self) where (T, Option<T>): Ord {} + fn bar(&self, x: &Option<T>) -> bool + where Option<T>: Ord { *x < *x } + } + impl Foo<X> for () {} + let _ = &() as &dyn Foo<X>; +} diff --git a/tests/ui/issues/issue-34569.rs b/tests/ui/issues/issue-34569.rs new file mode 100644 index 000000000..88dcdd411 --- /dev/null +++ b/tests/ui/issues/issue-34569.rs @@ -0,0 +1,18 @@ +// run-pass +// compile-flags:-g +// ignore-asmjs wasm2js does not support source maps yet + +// In this test we just want to make sure that the code below does not lead to +// a debuginfo verification assertion during compilation. This was caused by the +// closure in the guard being codegened twice due to how match expressions are +// handled. +// +// See https://github.com/rust-lang/rust/issues/34569 for details. + +fn main() { + match 0 { + e if (|| { e == 0 })() => {}, + 1 => {}, + _ => {} + } +} diff --git a/tests/ui/issues/issue-34571.rs b/tests/ui/issues/issue-34571.rs new file mode 100644 index 000000000..5498091da --- /dev/null +++ b/tests/ui/issues/issue-34571.rs @@ -0,0 +1,11 @@ +// run-pass +#[repr(u8)] +enum Foo { + Foo(#[allow(unused_tuple_struct_fields)] u8), +} + +fn main() { + match Foo::Foo(1) { + _ => () + } +} diff --git a/tests/ui/issues/issue-34721.fixed b/tests/ui/issues/issue-34721.fixed new file mode 100644 index 000000000..f135ad383 --- /dev/null +++ b/tests/ui/issues/issue-34721.fixed @@ -0,0 +1,34 @@ +// run-rustfix + +pub trait Foo { + fn zero(self) -> Self; +} + +impl Foo for u32 { + fn zero(self) -> u32 { 0u32 } +} + +pub mod bar { + pub use Foo; + pub fn bar<T: Foo>(x: T) -> T { + x.zero() + } +} + +mod baz { + use bar; + use Foo; + pub fn baz<T: Foo + Copy>(x: T) -> T { + if 0 == 1 { + bar::bar(x.zero()) + } else { + x.zero() + }; + x.zero() + //~^ ERROR use of moved value + } +} + +fn main() { + let _ = baz::baz(0u32); +} diff --git a/tests/ui/issues/issue-34721.rs b/tests/ui/issues/issue-34721.rs new file mode 100644 index 000000000..14dd01766 --- /dev/null +++ b/tests/ui/issues/issue-34721.rs @@ -0,0 +1,34 @@ +// run-rustfix + +pub trait Foo { + fn zero(self) -> Self; +} + +impl Foo for u32 { + fn zero(self) -> u32 { 0u32 } +} + +pub mod bar { + pub use Foo; + pub fn bar<T: Foo>(x: T) -> T { + x.zero() + } +} + +mod baz { + use bar; + use Foo; + pub fn baz<T: Foo>(x: T) -> T { + if 0 == 1 { + bar::bar(x.zero()) + } else { + x.zero() + }; + x.zero() + //~^ ERROR use of moved value + } +} + +fn main() { + let _ = baz::baz(0u32); +} diff --git a/tests/ui/issues/issue-34721.stderr b/tests/ui/issues/issue-34721.stderr new file mode 100644 index 000000000..f2bf22227 --- /dev/null +++ b/tests/ui/issues/issue-34721.stderr @@ -0,0 +1,28 @@ +error[E0382]: use of moved value: `x` + --> $DIR/issue-34721.rs:27:9 + | +LL | pub fn baz<T: Foo>(x: T) -> T { + | - move occurs because `x` has type `T`, which does not implement the `Copy` trait +LL | if 0 == 1 { +LL | bar::bar(x.zero()) + | ------ `x` moved due to this method call +LL | } else { +LL | x.zero() + | ------ `x` moved due to this method call +LL | }; +LL | x.zero() + | ^ value used here after move + | +note: `Foo::zero` takes ownership of the receiver `self`, which moves `x` + --> $DIR/issue-34721.rs:4:13 + | +LL | fn zero(self) -> Self; + | ^^^^ +help: consider further restricting this bound + | +LL | pub fn baz<T: Foo + Copy>(x: T) -> T { + | ++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-34751.rs b/tests/ui/issues/issue-34751.rs new file mode 100644 index 000000000..6309c0a02 --- /dev/null +++ b/tests/ui/issues/issue-34751.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(dead_code)] +// #34751 ICE: 'rustc' panicked at 'assertion failed: !substs.has_regions_escaping_depth(0)' + +#[allow(dead_code)] + +use std::marker::PhantomData; + +fn f<'a>(PhantomData::<&'a u8>: PhantomData<&'a u8>) {} + +fn main() {} diff --git a/tests/ui/issues/issue-3477.rs b/tests/ui/issues/issue-3477.rs new file mode 100644 index 000000000..3817d0e6a --- /dev/null +++ b/tests/ui/issues/issue-3477.rs @@ -0,0 +1,5 @@ +fn main() { + let _p: char = 100; + //~^ ERROR mismatched types + //~| expected `char`, found `u8` +} diff --git a/tests/ui/issues/issue-3477.stderr b/tests/ui/issues/issue-3477.stderr new file mode 100644 index 000000000..fd5f7dcf6 --- /dev/null +++ b/tests/ui/issues/issue-3477.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/issue-3477.rs:2:20 + | +LL | let _p: char = 100; + | ---- ^^^ expected `char`, found `u8` + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-34780.rs b/tests/ui/issues/issue-34780.rs new file mode 100644 index 000000000..fbedad35b --- /dev/null +++ b/tests/ui/issues/issue-34780.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(stable_features)] +#![feature(associated_consts)] + +use std::marker::PhantomData; + +trait Tr<'a> { + const C: PhantomData<&'a u8> = PhantomData::<&'a u8>; +} + +fn main() {} diff --git a/tests/ui/issues/issue-34796.rs b/tests/ui/issues/issue-34796.rs new file mode 100644 index 000000000..88d5c50a2 --- /dev/null +++ b/tests/ui/issues/issue-34796.rs @@ -0,0 +1,28 @@ +// run-pass +#![allow(dead_code)] +// This test case exposes conditions where the encoding of a trait object type +// with projection predicates would differ between this crate and the upstream +// crate, because the predicates were encoded in different order within each +// crate. This led to different symbol hashes of functions using these type, +// which in turn led to linker errors because the two crates would not agree on +// the symbol name. +// The fix was to make the order in which predicates get encoded stable. + +// aux-build:issue-34796-aux.rs +extern crate issue_34796_aux; + +fn mk<T>() -> T { loop {} } + +struct Data<T, E> { + data: T, + error: E, +} + +fn main() { + issue_34796_aux::bar(|()| { + Data::<(), std::io::Error> { + data: mk(), + error: mk(), + } + }) +} diff --git a/tests/ui/issues/issue-34839.rs b/tests/ui/issues/issue-34839.rs new file mode 100644 index 000000000..8ffed827e --- /dev/null +++ b/tests/ui/issues/issue-34839.rs @@ -0,0 +1,19 @@ +// check-pass + +trait RegularExpression: Sized { + type Text; +} + +struct ExecNoSyncStr<'a>(&'a u8); + +impl<'c> RegularExpression for ExecNoSyncStr<'c> { + type Text = u8; +} + +struct FindCaptures<'t, R>(&'t R::Text) where R: RegularExpression, R::Text: 't; + +enum FindCapturesInner<'r, 't> { + Dynamic(FindCaptures<'t, ExecNoSyncStr<'r>>), +} + +fn main() {} diff --git a/tests/ui/issues/issue-34932.rs b/tests/ui/issues/issue-34932.rs new file mode 100644 index 000000000..ab568fd01 --- /dev/null +++ b/tests/ui/issues/issue-34932.rs @@ -0,0 +1,11 @@ +// run-pass +// compile-flags:--test +#![cfg(any())] // This test should be configured away +#![feature(rustc_attrs)] // Test that this is allowed on stable/beta +#![feature(iter_arith_traits)] // Test that this is not unused +#![deny(unused_features)] + +#[test] +fn dummy() { + let () = "this should not reach type-checking"; +} diff --git a/tests/ui/issues/issue-3500.rs b/tests/ui/issues/issue-3500.rs new file mode 100644 index 000000000..7b39cc16c --- /dev/null +++ b/tests/ui/issues/issue-3500.rs @@ -0,0 +1,10 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let x = &Some(1); + match x { + &Some(_) => (), + &None => (), + } +} diff --git a/tests/ui/issues/issue-35139.rs b/tests/ui/issues/issue-35139.rs new file mode 100644 index 000000000..e462f3543 --- /dev/null +++ b/tests/ui/issues/issue-35139.rs @@ -0,0 +1,26 @@ +use std::fmt; + +pub trait MethodType { + type GetProp: ?Sized; +} + +pub struct MTFn; + +impl<'a> MethodType for MTFn { //~ ERROR E0207 + type GetProp = dyn fmt::Debug + 'a; +} + +fn bad(a: Box<<MTFn as MethodType>::GetProp>) -> Box<dyn fmt::Debug+'static> { + a +} + +fn dangling(a: &str) -> Box<dyn fmt::Debug> { + bad(Box::new(a)) +} + +fn main() { + let mut s = "hello".to_string(); + let x = dangling(&s); + s = String::new(); + println!("{:?}", x); +} diff --git a/tests/ui/issues/issue-35139.stderr b/tests/ui/issues/issue-35139.stderr new file mode 100644 index 000000000..79e889b7e --- /dev/null +++ b/tests/ui/issues/issue-35139.stderr @@ -0,0 +1,9 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-35139.rs:9:6 + | +LL | impl<'a> MethodType for MTFn { + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/issues/issue-3521-2.fixed b/tests/ui/issues/issue-3521-2.fixed new file mode 100644 index 000000000..140c24b93 --- /dev/null +++ b/tests/ui/issues/issue-3521-2.fixed @@ -0,0 +1,9 @@ +// run-rustfix +fn main() { + let foo = 100; + + let y: isize = foo + 1; + //~^ ERROR attempt to use a non-constant value in a constant + + println!("{}", y); +} diff --git a/tests/ui/issues/issue-3521-2.rs b/tests/ui/issues/issue-3521-2.rs new file mode 100644 index 000000000..f66efec45 --- /dev/null +++ b/tests/ui/issues/issue-3521-2.rs @@ -0,0 +1,9 @@ +// run-rustfix +fn main() { + let foo = 100; + + static y: isize = foo + 1; + //~^ ERROR attempt to use a non-constant value in a constant + + println!("{}", y); +} diff --git a/tests/ui/issues/issue-3521-2.stderr b/tests/ui/issues/issue-3521-2.stderr new file mode 100644 index 000000000..84c7a9efa --- /dev/null +++ b/tests/ui/issues/issue-3521-2.stderr @@ -0,0 +1,11 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/issue-3521-2.rs:5:23 + | +LL | static y: isize = foo + 1; + | -------- ^^^ non-constant value + | | + | help: consider using `let` instead of `static`: `let y` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/issues/issue-35241.rs b/tests/ui/issues/issue-35241.rs new file mode 100644 index 000000000..2fa762475 --- /dev/null +++ b/tests/ui/issues/issue-35241.rs @@ -0,0 +1,5 @@ +struct Foo(u32); + +fn test() -> Foo { Foo } //~ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/issues/issue-35241.stderr b/tests/ui/issues/issue-35241.stderr new file mode 100644 index 000000000..d600e934b --- /dev/null +++ b/tests/ui/issues/issue-35241.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-35241.rs:3:20 + | +LL | struct Foo(u32); + | ---------- `Foo` defines a struct constructor here, which should be called +LL | +LL | fn test() -> Foo { Foo } + | --- ^^^ expected struct `Foo`, found struct constructor + | | + | expected `Foo` because of return type + | + = note: expected struct `Foo` + found struct constructor `fn(u32) -> Foo {Foo}` +help: use parentheses to construct this tuple struct + | +LL | fn test() -> Foo { Foo(/* u32 */) } + | +++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-35423.rs b/tests/ui/issues/issue-35423.rs new file mode 100644 index 000000000..202ffcc1d --- /dev/null +++ b/tests/ui/issues/issue-35423.rs @@ -0,0 +1,9 @@ +// run-pass +fn main () { + let x = 4; + match x { + ref r if *r < 0 => println!("got negative num {} < 0", r), + e @ 1 ..= 100 => println!("got number within range [1,100] {}", e), + _ => println!("no"), + } +} diff --git a/tests/ui/issues/issue-3556.rs b/tests/ui/issues/issue-3556.rs new file mode 100644 index 000000000..3c1934ade --- /dev/null +++ b/tests/ui/issues/issue-3556.rs @@ -0,0 +1,36 @@ +// run-pass +#![allow(dead_code)] + +#[derive(Debug)] +enum Token { + Text(String), + ETag(Vec<String>, String), + UTag(Vec<String>, String), + Section(Vec<String>, bool, Vec<Token>, String, + String, String, String, String), + IncompleteSection(Vec<String>, bool, String, bool), + Partial(String, String, String), +} + +fn check_strs(actual: &str, expected: &str) -> bool +{ + if actual != expected + { + println!("Found {}, but expected {}", actual, expected); + return false; + } + return true; +} + +pub fn main() +{ + let t = Token::Text("foo".to_string()); + let u = Token::Section(vec!["alpha".to_string()], + true, + vec![t], + "foo".to_string(), + "foo".to_string(), "foo".to_string(), "foo".to_string(), + "foo".to_string()); + let v = format!("{:?}", u); // this is the line that causes the seg fault + assert!(!v.is_empty()); +} diff --git a/tests/ui/issues/issue-35570.rs b/tests/ui/issues/issue-35570.rs new file mode 100644 index 000000000..a2b0222d4 --- /dev/null +++ b/tests/ui/issues/issue-35570.rs @@ -0,0 +1,29 @@ +use std::mem; + +trait Trait1<T> {} +trait Trait2<'a> { + type Ty; +} + +fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) { + //~^ ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied + //~| ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied + let _e: (usize, usize) = unsafe{mem::transmute(param)}; +} + +trait Lifetime<'a> { + type Out; +} +impl<'a> Lifetime<'a> for () { + type Out = &'a (); +} +fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out { + x +} + +fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) { +} + +fn main() { + takes_lifetime(foo); +} diff --git a/tests/ui/issues/issue-35570.stderr b/tests/ui/issues/issue-35570.stderr new file mode 100644 index 000000000..3dc33729d --- /dev/null +++ b/tests/ui/issues/issue-35570.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/issue-35570.rs:8:40 + | +LL | fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) { + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()` + +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/issue-35570.rs:8:1 + | +LL | / fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) { +LL | | +LL | | +LL | | let _e: (usize, usize) = unsafe{mem::transmute(param)}; +LL | | } + | |_^ the trait `for<'a> Trait2<'a>` is not implemented for `()` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-3559.rs b/tests/ui/issues/issue-3559.rs new file mode 100644 index 000000000..9d498584a --- /dev/null +++ b/tests/ui/issues/issue-3559.rs @@ -0,0 +1,18 @@ +// run-pass +use std::collections::HashMap; + +fn check_strs(actual: &str, expected: &str) -> bool { + if actual != expected { + println!("Found {}, but expected {}", actual, expected); + return false; + } + return true; +} + +pub fn main() { + let mut table = HashMap::new(); + table.insert("one".to_string(), 1); + table.insert("two".to_string(), 2); + assert!(check_strs(&format!("{:?}", table), "{\"one\": 1, \"two\": 2}") || + check_strs(&format!("{:?}", table), "{\"two\": 2, \"one\": 1}")); +} diff --git a/tests/ui/issues/issue-35600.rs b/tests/ui/issues/issue-35600.rs new file mode 100644 index 000000000..f0bab6010 --- /dev/null +++ b/tests/ui/issues/issue-35600.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(non_camel_case_types)] +#![allow(unused_variables)] + +trait Foo { + type bar; + fn bar(); +} + +impl Foo for () { + type bar = (); + fn bar() {} +} + +fn main() { + let x: <() as Foo>::bar = (); + <()>::bar(); +} diff --git a/tests/ui/issues/issue-3563-3.rs b/tests/ui/issues/issue-3563-3.rs new file mode 100644 index 000000000..bedfdab97 --- /dev/null +++ b/tests/ui/issues/issue-3563-3.rs @@ -0,0 +1,180 @@ +// run-pass +#![allow(unused_imports)] +#![allow(non_snake_case)] + +// ASCII art shape renderer. Demonstrates traits, impls, operator overloading, +// non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && +// ./shapes + +// Rust's std library is tightly bound to the language itself so it is +// automatically linked in. However the extra library is designed to be +// optional (for code that must run on constrained environments like embedded +// devices or special environments like kernel code) so it must be explicitly +// linked in. + +// Extern mod controls linkage. Use controls the visibility of names to modules +// that are already linked in. Using WriterUtil allows us to use the write_line +// method. + +use std::fmt; +use std::iter::repeat; +use std::slice; + +// Represents a position on a canvas. +#[derive(Copy, Clone)] +struct Point { + x: isize, + y: isize, +} + +// Represents an offset on a canvas. (This has the same structure as a Point. +// but different semantics). +#[derive(Copy, Clone)] +struct Size { + width: isize, + height: isize, +} + +#[derive(Copy, Clone)] +struct Rect { + top_left: Point, + size: Size, +} + +// Contains the information needed to do shape rendering via ASCII art. +struct AsciiArt { + width: usize, + height: usize, + fill: char, + lines: Vec<Vec<char> > , + + // This struct can be quite large so we'll disable copying: developers need + // to either pass these structs around via references or move them. +} + +impl Drop for AsciiArt { + fn drop(&mut self) {} +} + +// It's common to define a constructor sort of function to create struct instances. +// If there is a canonical constructor it is typically named the same as the type. +// Other constructor sort of functions are typically named from_foo, from_bar, etc. +fn AsciiArt(width: usize, height: usize, fill: char) -> AsciiArt { + // Build a vector of vectors containing blank characters for each position in + // our canvas. + let lines = vec![vec!['.'; width]; height]; + + // Rust code often returns values by omitting the trailing semi-colon + // instead of using an explicit return statement. + AsciiArt {width: width, height: height, fill: fill, lines: lines} +} + +// Methods particular to the AsciiArt struct. +impl AsciiArt { + fn add_pt(&mut self, x: isize, y: isize) { + if x >= 0 && x < self.width as isize { + if y >= 0 && y < self.height as isize { + // Note that numeric types don't implicitly convert to each other. + let v = y as usize; + let h = x as usize; + + // Vector subscripting will normally copy the element, but &v[i] + // will return a reference which is what we need because the + // element is: + // 1) potentially large + // 2) needs to be modified + let row = &mut self.lines[v]; + row[h] = self.fill; + } + } + } +} + +// Allows AsciiArt to be converted to a string using the libcore ToString trait. +// Note that the %s fmt! specifier will not call this automatically. +impl fmt::Display for AsciiArt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // Convert each line into a string. + let lines = self.lines.iter() + .map(|line| line.iter().cloned().collect()) + .collect::<Vec<String>>(); + + // Concatenate the lines together using a new-line. + write!(f, "{}", lines.join("\n")) + } +} + +// This is similar to an interface in other languages: it defines a protocol which +// developers can implement for arbitrary concrete types. +trait Canvas { + fn add_point(&mut self, shape: Point); + fn add_rect(&mut self, shape: Rect); + + // Unlike interfaces traits support default implementations. + // Got an ICE as soon as I added this method. + fn add_points(&mut self, shapes: &[Point]) { + for pt in shapes {self.add_point(*pt)}; + } +} + +// Here we provide an implementation of the Canvas methods for AsciiArt. +// Other implementations could also be provided (e.g., for PDF or Apple's Quartz) +// and code can use them polymorphically via the Canvas trait. +impl Canvas for AsciiArt { + fn add_point(&mut self, shape: Point) { + self.add_pt(shape.x, shape.y); + } + + fn add_rect(&mut self, shape: Rect) { + // Add the top and bottom lines. + for x in shape.top_left.x..shape.top_left.x + shape.size.width { + self.add_pt(x, shape.top_left.y); + self.add_pt(x, shape.top_left.y + shape.size.height - 1); + } + + // Add the left and right lines. + for y in shape.top_left.y..shape.top_left.y + shape.size.height { + self.add_pt(shape.top_left.x, y); + self.add_pt(shape.top_left.x + shape.size.width - 1, y); + } + } +} + +// Rust's unit testing framework is currently a bit under-developed so we'll use +// this little helper. +pub fn check_strs(actual: &str, expected: &str) -> bool { + if actual != expected { + println!("Found:\n{}\nbut expected\n{}", actual, expected); + return false; + } + return true; +} + + +fn test_ascii_art_ctor() { + let art = AsciiArt(3, 3, '*'); + assert!(check_strs(&art.to_string(), "...\n...\n...")); +} + + +fn test_add_pt() { + let mut art = AsciiArt(3, 3, '*'); + art.add_pt(0, 0); + art.add_pt(0, -10); + art.add_pt(1, 2); + assert!(check_strs(&art.to_string(), "*..\n...\n.*.")); +} + + +fn test_shapes() { + let mut art = AsciiArt(4, 4, '*'); + art.add_rect(Rect {top_left: Point {x: 0, y: 0}, size: Size {width: 4, height: 4}}); + art.add_point(Point {x: 2, y: 2}); + assert!(check_strs(&art.to_string(), "****\n*..*\n*.**\n****")); +} + +pub fn main() { + test_ascii_art_ctor(); + test_add_pt(); + test_shapes(); +} diff --git a/tests/ui/issues/issue-3574.rs b/tests/ui/issues/issue-3574.rs new file mode 100644 index 000000000..eb967577f --- /dev/null +++ b/tests/ui/issues/issue-3574.rs @@ -0,0 +1,14 @@ +// run-pass +// rustc --test match_borrowed_str.rs.rs && ./match_borrowed_str.rs + + +fn compare(x: &str, y: &str) -> bool { + match x { + "foo" => y == "foo", + _ => y == "bar", + } +} + +pub fn main() { + assert!(compare("foo", "foo")); +} diff --git a/tests/ui/issues/issue-35815.rs b/tests/ui/issues/issue-35815.rs new file mode 100644 index 000000000..05fd1b15d --- /dev/null +++ b/tests/ui/issues/issue-35815.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] +use std::mem; + +struct Foo<T: ?Sized> { + a: i64, + b: bool, + c: T, +} + +fn main() { + let foo: &Foo<i32> = &Foo { a: 1, b: false, c: 2i32 }; + let foo_unsized: &Foo<dyn Send> = foo; + assert_eq!(mem::size_of_val(foo), mem::size_of_val(foo_unsized)); +} diff --git a/tests/ui/issues/issue-35976.rs b/tests/ui/issues/issue-35976.rs new file mode 100644 index 000000000..aa6f74cb5 --- /dev/null +++ b/tests/ui/issues/issue-35976.rs @@ -0,0 +1,24 @@ +// revisions: imported unimported +//[imported] check-pass + +mod private { + pub trait Future { + //[unimported]~^^ HELP perhaps add a `use` for it + fn wait(&self) where Self: Sized; + } + + impl Future for Box<dyn Future> { + fn wait(&self) { } + } +} + +#[cfg(imported)] +use private::Future; + +fn bar(arg: Box<dyn private::Future>) { + // Importing the trait means that we don't autoderef `Box<dyn Future>` + arg.wait(); + //[unimported]~^ ERROR the `wait` method cannot be invoked on a trait object +} + +fn main() {} diff --git a/tests/ui/issues/issue-35976.unimported.stderr b/tests/ui/issues/issue-35976.unimported.stderr new file mode 100644 index 000000000..5d61bb8ea --- /dev/null +++ b/tests/ui/issues/issue-35976.unimported.stderr @@ -0,0 +1,16 @@ +error: the `wait` method cannot be invoked on a trait object + --> $DIR/issue-35976.rs:20:9 + | +LL | fn wait(&self) where Self: Sized; + | ----- this has a `Sized` requirement +... +LL | arg.wait(); + | ^^^^ + | +help: another candidate was found in the following trait, perhaps add a `use` for it: + | +LL | use private::Future; + | + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-35988.rs b/tests/ui/issues/issue-35988.rs new file mode 100644 index 000000000..5cf2f8e52 --- /dev/null +++ b/tests/ui/issues/issue-35988.rs @@ -0,0 +1,6 @@ +enum E { + V([Box<E>]), + //~^ ERROR the size for values of type +} + +fn main() {} diff --git a/tests/ui/issues/issue-35988.stderr b/tests/ui/issues/issue-35988.stderr new file mode 100644 index 000000000..55988844c --- /dev/null +++ b/tests/ui/issues/issue-35988.stderr @@ -0,0 +1,21 @@ +error[E0277]: the size for values of type `[Box<E>]` cannot be known at compilation time + --> $DIR/issue-35988.rs:2:7 + | +LL | V([Box<E>]), + | ^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[Box<E>]` + = note: no field of an enum variant may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | V(&[Box<E>]), + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | V(Box<[Box<E>]>), + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-36023.rs b/tests/ui/issues/issue-36023.rs new file mode 100644 index 000000000..64d92bf8c --- /dev/null +++ b/tests/ui/issues/issue-36023.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(unused_variables)] +use std::ops::Deref; + +fn main() { + if env_var("FOOBAR").as_ref().map(Deref::deref).ok() == Some("yes") { + panic!() + } + + let env_home: Result<String, ()> = Ok("foo-bar-baz".to_string()); + let env_home = env_home.as_ref().map(Deref::deref).ok(); + + if env_home == Some("") { panic!() } +} + +#[inline(never)] +fn env_var(s: &str) -> Result<String, VarError> { + Err(VarError::NotPresent) +} + +pub enum VarError { + NotPresent, + NotUnicode(String), +} diff --git a/tests/ui/issues/issue-36036-associated-type-layout.rs b/tests/ui/issues/issue-36036-associated-type-layout.rs new file mode 100644 index 000000000..022f9a5d5 --- /dev/null +++ b/tests/ui/issues/issue-36036-associated-type-layout.rs @@ -0,0 +1,27 @@ +// run-pass +// Issue 36036: computing the layout of a type composed from another +// trait's associated type caused compiler to ICE when the associated +// type was allowed to be unsized, even though the known instantiated +// type is itself sized. + +#![allow(dead_code)] + +trait Context { + type Container: ?Sized; +} + +impl Context for u16 { + type Container = u8; +} + +struct Wrapper<C: Context+'static> { + container: &'static C::Container +} + +fn foobar(_: Wrapper<u16>) {} + +static VALUE: u8 = 0; + +fn main() { + foobar(Wrapper { container: &VALUE }); +} diff --git a/tests/ui/issues/issue-36075.rs b/tests/ui/issues/issue-36075.rs new file mode 100644 index 000000000..bc5bdc3ff --- /dev/null +++ b/tests/ui/issues/issue-36075.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +trait DeclarationParser { + type Declaration; +} + +struct DeclarationListParser<'i, I, P> + where P: DeclarationParser<Declaration = I> +{ + input: &'i (), + parser: P +} + +fn main() {} diff --git a/tests/ui/issues/issue-3609.rs b/tests/ui/issues/issue-3609.rs new file mode 100644 index 000000000..57ff12a08 --- /dev/null +++ b/tests/ui/issues/issue-3609.rs @@ -0,0 +1,30 @@ +// check-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_mut)] +use std::thread; +use std::sync::mpsc::Sender; + +type RingBuffer = Vec<f64> ; +type SamplesFn = Box<dyn FnMut(&RingBuffer) + Send>; + +enum Msg +{ + GetSamples(String, SamplesFn), // sample set name, callback which receives samples +} + +fn foo(name: String, samples_chan: Sender<Msg>) { + thread::spawn(move|| { + let mut samples_chan = samples_chan; + + let callback: SamplesFn = Box::new(move |buffer| { + for i in 0..buffer.len() { + println!("{}: {}", i, buffer[i]) + } + }); + + samples_chan.send(Msg::GetSamples(name.clone(), callback)); + }).join(); +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-36116.rs b/tests/ui/issues/issue-36116.rs new file mode 100644 index 000000000..c7c70c7af --- /dev/null +++ b/tests/ui/issues/issue-36116.rs @@ -0,0 +1,25 @@ +// Unnecessary path disambiguator is ok + +// check-pass + +macro_rules! m { + ($p: path) => { + let _ = $p(0); + let _: $p; + } +} + +struct Foo<T> { + _a: T, +} + +struct S<T>(T); + +fn f() { + let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); + let g: Foo::<i32> = Foo { _a: 42 }; + + m!(S::<u8>); +} + +fn main() {} diff --git a/tests/ui/issues/issue-36260.rs b/tests/ui/issues/issue-36260.rs new file mode 100644 index 000000000..d96dc80ea --- /dev/null +++ b/tests/ui/issues/issue-36260.rs @@ -0,0 +1,13 @@ +// run-pass +// Make sure this compiles without getting a linker error because of missing +// drop-glue because the collector missed adding drop-glue for the closure: + +fn create_fn() -> Box<dyn Fn()> { + let text = String::new(); + + Box::new(move || { let _ = &text; }) +} + +fn main() { + let _ = create_fn(); +} diff --git a/tests/ui/issues/issue-36278-prefix-nesting.rs b/tests/ui/issues/issue-36278-prefix-nesting.rs new file mode 100644 index 000000000..a809f7f13 --- /dev/null +++ b/tests/ui/issues/issue-36278-prefix-nesting.rs @@ -0,0 +1,20 @@ +// run-pass +// Issue 36278: On an unsized struct with >1 level of nontrivial +// nesting, ensure we are computing dynamic size of prefix correctly. + +use std::mem; + +const SZ: usize = 100; +#[allow(unused_tuple_struct_fields)] +struct P<T: ?Sized>([u8; SZ], T); + +type Ack<T> = P<P<T>>; + +fn main() { + let size_of_sized; let size_of_unsized; + let x: Box<Ack<[u8; 0]>> = Box::new(P([0; SZ], P([0; SZ], [0; 0]))); + size_of_sized = mem::size_of_val::<Ack<_>>(&x); + let y: Box<Ack<[u8 ]>> = x; + size_of_unsized = mem::size_of_val::<Ack<_>>(&y); + assert_eq!(size_of_sized, size_of_unsized); +} diff --git a/tests/ui/issues/issue-36299.rs b/tests/ui/issues/issue-36299.rs new file mode 100644 index 000000000..7b68420b7 --- /dev/null +++ b/tests/ui/issues/issue-36299.rs @@ -0,0 +1,5 @@ +struct Foo<'a, A> {} +//~^ ERROR parameter `'a` is never used +//~| ERROR parameter `A` is never used + +fn main() {} diff --git a/tests/ui/issues/issue-36299.stderr b/tests/ui/issues/issue-36299.stderr new file mode 100644 index 000000000..dc24fb353 --- /dev/null +++ b/tests/ui/issues/issue-36299.stderr @@ -0,0 +1,20 @@ +error[E0392]: parameter `'a` is never used + --> $DIR/issue-36299.rs:1:12 + | +LL | struct Foo<'a, A> {} + | ^^ unused parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: parameter `A` is never used + --> $DIR/issue-36299.rs:1:16 + | +LL | struct Foo<'a, A> {} + | ^ unused parameter + | + = help: consider removing `A`, referring to it in a field, or using a marker such as `PhantomData` + = help: if you intended `A` to be a const parameter, use `const A: usize` instead + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/issues/issue-36379.rs b/tests/ui/issues/issue-36379.rs new file mode 100644 index 000000000..3a3e6f470 --- /dev/null +++ b/tests/ui/issues/issue-36379.rs @@ -0,0 +1,5 @@ +// check-pass + +fn _test() -> impl Default { } + +fn main() {} diff --git a/tests/ui/issues/issue-36400.rs b/tests/ui/issues/issue-36400.rs new file mode 100644 index 000000000..a405f9b11 --- /dev/null +++ b/tests/ui/issues/issue-36400.rs @@ -0,0 +1,6 @@ +fn f(x: &mut u32) {} + +fn main() { + let x = Box::new(3); + f(&mut *x); //~ ERROR cannot borrow `*x` as mutable, as `x` is not declared as mutable +} diff --git a/tests/ui/issues/issue-36400.stderr b/tests/ui/issues/issue-36400.stderr new file mode 100644 index 000000000..5b753c69d --- /dev/null +++ b/tests/ui/issues/issue-36400.stderr @@ -0,0 +1,14 @@ +error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable + --> $DIR/issue-36400.rs:5:7 + | +LL | f(&mut *x); + | ^^^^^^^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | let mut x = Box::new(3); + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/issues/issue-36401.rs b/tests/ui/issues/issue-36401.rs new file mode 100644 index 000000000..f51197b01 --- /dev/null +++ b/tests/ui/issues/issue-36401.rs @@ -0,0 +1,16 @@ +// run-pass +#[derive(Debug)] +pub enum Event { + Key(u8), + Resize, + Unknown(u16), +} + +static XTERM_SINGLE_BYTES : [(u8, Event); 1] = [(1, Event::Resize)]; + +fn main() { + match XTERM_SINGLE_BYTES[0] { + (1, Event::Resize) => {}, + ref bad => panic!("unexpected {:?}", bad) + } +} diff --git a/tests/ui/issues/issue-36474.rs b/tests/ui/issues/issue-36474.rs new file mode 100644 index 000000000..90ee5b3cd --- /dev/null +++ b/tests/ui/issues/issue-36474.rs @@ -0,0 +1,31 @@ +// run-pass +fn main() { + remove_axis(&3, 0); +} + +trait Dimension { + fn slice(&self) -> &[usize]; +} + +impl Dimension for () { + fn slice(&self) -> &[usize] { &[] } +} + +impl Dimension for usize { + fn slice(&self) -> &[usize] { + unsafe { + ::std::slice::from_raw_parts(self, 1) + } + } +} + +fn remove_axis(value: &usize, axis: usize) -> () { + let tup = (); + let mut it = tup.slice().iter(); + for (i, _) in value.slice().iter().enumerate() { + if i == axis { + continue; + } + it.next(); + } +} diff --git a/tests/ui/issues/issue-3656.rs b/tests/ui/issues/issue-3656.rs new file mode 100644 index 000000000..4a9f94306 --- /dev/null +++ b/tests/ui/issues/issue-3656.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(dead_code)] +#![allow(improper_ctypes)] +// Issue #3656 +// Incorrect struct size computation in the FFI, because of not taking +// the alignment of elements into account. + +// pretty-expanded FIXME #23616 +// ignore-wasm32-bare no libc to test with +#![feature(rustc_private)] + +extern crate libc; +use libc::{c_uint, c_void}; + +pub struct KEYGEN { + hash_algorithm: [c_uint; 2], + count: u32, + salt: *const c_void, + salt_size: u32, +} + +extern "C" { + // Bogus signature, just need to test if it compiles. + pub fn malloc(data: KEYGEN); +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-3668-2.fixed b/tests/ui/issues/issue-3668-2.fixed new file mode 100644 index 000000000..a95781c6e --- /dev/null +++ b/tests/ui/issues/issue-3668-2.fixed @@ -0,0 +1,8 @@ +// run-rustfix +#![allow(unused_variables, dead_code)] +fn f(x:isize) { + let child: isize = x + 1; + //~^ ERROR attempt to use a non-constant value in a constant +} + +fn main() {} diff --git a/tests/ui/issues/issue-3668-2.rs b/tests/ui/issues/issue-3668-2.rs new file mode 100644 index 000000000..8aa0897ec --- /dev/null +++ b/tests/ui/issues/issue-3668-2.rs @@ -0,0 +1,8 @@ +// run-rustfix +#![allow(unused_variables, dead_code)] +fn f(x:isize) { + static child: isize = x + 1; + //~^ ERROR attempt to use a non-constant value in a constant +} + +fn main() {} diff --git a/tests/ui/issues/issue-3668-2.stderr b/tests/ui/issues/issue-3668-2.stderr new file mode 100644 index 000000000..ba9651041 --- /dev/null +++ b/tests/ui/issues/issue-3668-2.stderr @@ -0,0 +1,11 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/issue-3668-2.rs:4:27 + | +LL | static child: isize = x + 1; + | ------------ ^ non-constant value + | | + | help: consider using `let` instead of `static`: `let child` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/issues/issue-3668.rs b/tests/ui/issues/issue-3668.rs new file mode 100644 index 000000000..0e1f19a75 --- /dev/null +++ b/tests/ui/issues/issue-3668.rs @@ -0,0 +1,14 @@ +struct P { child: Option<Box<P>> } +trait PTrait { + fn getChildOption(&self) -> Option<Box<P>>; +} + +impl PTrait for P { + fn getChildOption(&self) -> Option<Box<P>> { + static childVal: Box<P> = self.child.get(); + //~^ ERROR attempt to use a non-constant value in a constant + panic!(); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-3668.stderr b/tests/ui/issues/issue-3668.stderr new file mode 100644 index 000000000..edc49979c --- /dev/null +++ b/tests/ui/issues/issue-3668.stderr @@ -0,0 +1,11 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/issue-3668.rs:8:34 + | +LL | static childVal: Box<P> = self.child.get(); + | --------------- ^^^^ non-constant value + | | + | help: consider using `let` instead of `static`: `let childVal` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/issues/issue-36744-bitcast-args-if-needed.rs b/tests/ui/issues/issue-36744-bitcast-args-if-needed.rs new file mode 100644 index 000000000..34bbb66d9 --- /dev/null +++ b/tests/ui/issues/issue-36744-bitcast-args-if-needed.rs @@ -0,0 +1,23 @@ +// run-pass +// This tests for an ICE (and, if ignored, subsequent LLVM abort) when +// a lifetime-parametric fn is passed into a context whose expected +// type has a differing lifetime parameterization. + +struct A<'a> { + _a: &'a i32, +} + +fn call<T>(s: T, functions: &Vec<for <'n> fn(&'n T)>) { + for function in functions { + function(&s); + } +} + +fn f(a: &A) { println!("a holds {}", a._a); } + +fn main() { + let a = A { _a: &10 }; + + let vec: Vec<for <'u,'v> fn(&'u A<'v>)> = vec![f]; + call(a, &vec); +} diff --git a/tests/ui/issues/issue-36744-without-calls.rs b/tests/ui/issues/issue-36744-without-calls.rs new file mode 100644 index 000000000..dc5dc4f13 --- /dev/null +++ b/tests/ui/issues/issue-36744-without-calls.rs @@ -0,0 +1,13 @@ +// build-pass +// Tests for an LLVM abort when storing a lifetime-parametric fn into +// context that is expecting one that is not lifetime-parametric +// (i.e., has no `for <'_>`). + +pub struct A<'a>(&'a ()); +pub struct S<T>(T); + +pub fn bad<'s>(v: &mut S<fn(A<'s>)>, y: S<for<'b> fn(A<'b>)>) { + *v = y; +} + +fn main() {} diff --git a/tests/ui/issues/issue-36786-resolve-call.rs b/tests/ui/issues/issue-36786-resolve-call.rs new file mode 100644 index 000000000..e5341ba7d --- /dev/null +++ b/tests/ui/issues/issue-36786-resolve-call.rs @@ -0,0 +1,8 @@ +// run-pass +// Ensure that types that rely on obligations are autoderefed +// correctly + +fn main() { + let x : Vec<Box<dyn Fn()>> = vec![Box::new(|| ())]; + x[0]() +} diff --git a/tests/ui/issues/issue-36792.rs b/tests/ui/issues/issue-36792.rs new file mode 100644 index 000000000..99ae633dd --- /dev/null +++ b/tests/ui/issues/issue-36792.rs @@ -0,0 +1,7 @@ +// run-pass +fn foo() -> impl Copy { + foo +} +fn main() { + foo(); +} diff --git a/tests/ui/issues/issue-3680.rs b/tests/ui/issues/issue-3680.rs new file mode 100644 index 000000000..37c9000c0 --- /dev/null +++ b/tests/ui/issues/issue-3680.rs @@ -0,0 +1,9 @@ +fn main() { + match None { + Err(_) => () + //~^ ERROR mismatched types + //~| expected enum `Option<_>` + //~| found enum `Result<_, _>` + //~| expected enum `Option`, found enum `Result` + } +} diff --git a/tests/ui/issues/issue-3680.stderr b/tests/ui/issues/issue-3680.stderr new file mode 100644 index 000000000..29ba44f13 --- /dev/null +++ b/tests/ui/issues/issue-3680.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-3680.rs:3:9 + | +LL | match None { + | ---- this expression has type `Option<_>` +LL | Err(_) => () + | ^^^^^^ expected enum `Option`, found enum `Result` + | + = note: expected enum `Option<_>` + found enum `Result<_, _>` +help: try wrapping the pattern in `Some` + | +LL | Some(Err(_)) => () + | +++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-36816.rs b/tests/ui/issues/issue-36816.rs new file mode 100644 index 000000000..54690b43c --- /dev/null +++ b/tests/ui/issues/issue-36816.rs @@ -0,0 +1,7 @@ +// run-pass +macro_rules! m { () => { 1 } } +macro_rules! n { () => { 1 + m!() } } + +fn main() { + let _: [u32; n!()] = [0, 0]; +} diff --git a/tests/ui/issues/issue-36836.rs b/tests/ui/issues/issue-36836.rs new file mode 100644 index 000000000..99c562131 --- /dev/null +++ b/tests/ui/issues/issue-36836.rs @@ -0,0 +1,15 @@ +// Previously, in addition to the real cause of the problem as seen below, +// the compiler would tell the user: +// +// ``` +// error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or +// predicates +// ``` +// +// With this test, we check that only the relevant error is emitted. + +trait Foo {} + +impl<T> Foo for Bar<T> {} //~ ERROR cannot find type `Bar` in this scope + +fn main() {} diff --git a/tests/ui/issues/issue-36836.stderr b/tests/ui/issues/issue-36836.stderr new file mode 100644 index 000000000..418194fac --- /dev/null +++ b/tests/ui/issues/issue-36836.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Bar` in this scope + --> $DIR/issue-36836.rs:13:17 + | +LL | impl<T> Foo for Bar<T> {} + | ^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-36839.rs b/tests/ui/issues/issue-36839.rs new file mode 100644 index 000000000..ca3d66b1c --- /dev/null +++ b/tests/ui/issues/issue-36839.rs @@ -0,0 +1,21 @@ +// check-pass + +pub trait Foo { + type Bar; +} + +pub trait Broken { + type Assoc; + fn broken(&self) where Self::Assoc: Foo; +} + +impl<T> Broken for T { + type Assoc = (); + fn broken(&self) where Self::Assoc: Foo { + let _x: <Self::Assoc as Foo>::Bar; + } +} + +fn main() { + let _m: &dyn Broken<Assoc=()> = &(); +} diff --git a/tests/ui/issues/issue-36856.rs b/tests/ui/issues/issue-36856.rs new file mode 100644 index 000000000..5657ba69f --- /dev/null +++ b/tests/ui/issues/issue-36856.rs @@ -0,0 +1,16 @@ +// run-pass +// Regression test for #36856. + +// compile-flags:-g +// ignore-asmjs wasm2js does not support source maps yet + +fn g() -> bool { + false +} + +pub fn main() { + let a = !g(); + if a != !g() { + panic!(); + } +} diff --git a/tests/ui/issues/issue-36936.rs b/tests/ui/issues/issue-36936.rs new file mode 100644 index 000000000..486a422b7 --- /dev/null +++ b/tests/ui/issues/issue-36936.rs @@ -0,0 +1,26 @@ +// run-pass +// check that casts are not being treated as lexprs. + +fn main() { + let mut a = 0i32; + let b = &(a as i32); + a = 1; + assert_ne!(&a as *const i32, b as *const i32); + assert_eq!(*b, 0); + + assert_eq!(issue_36936(), 1); +} + + +struct A(u32); + +impl Drop for A { + fn drop(&mut self) { + self.0 = 0; + } +} + +fn issue_36936() -> u32 { + let a = &(A(1) as A); + a.0 +} diff --git a/tests/ui/issues/issue-36954.rs b/tests/ui/issues/issue-36954.rs new file mode 100644 index 000000000..56ff9926e --- /dev/null +++ b/tests/ui/issues/issue-36954.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-36954.rs + +extern crate issue_36954 as lib; + +fn main() { + let _ = lib::FOO; +} diff --git a/tests/ui/issues/issue-3702-2.rs b/tests/ui/issues/issue-3702-2.rs new file mode 100644 index 000000000..d47f6d248 --- /dev/null +++ b/tests/ui/issues/issue-3702-2.rs @@ -0,0 +1,20 @@ +pub trait ToPrimitive { + fn to_int(&self) -> isize { 0 } +} + +impl ToPrimitive for i32 {} +impl ToPrimitive for isize {} + +trait Add { + fn to_int(&self) -> isize; + fn add_dynamic(&self, other: &dyn Add) -> isize; +} + +impl Add for isize { + fn to_int(&self) -> isize { *self } + fn add_dynamic(&self, other: &dyn Add) -> isize { + self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope + } +} + +fn main() { } diff --git a/tests/ui/issues/issue-3702-2.stderr b/tests/ui/issues/issue-3702-2.stderr new file mode 100644 index 000000000..1fd64ca90 --- /dev/null +++ b/tests/ui/issues/issue-3702-2.stderr @@ -0,0 +1,28 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/issue-3702-2.rs:16:14 + | +LL | self.to_int() + other.to_int() + | ^^^^^^ multiple `to_int` found + | +note: candidate #1 is defined in an impl of the trait `ToPrimitive` for the type `isize` + --> $DIR/issue-3702-2.rs:2:5 + | +LL | fn to_int(&self) -> isize { 0 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `Add` for the type `isize` + --> $DIR/issue-3702-2.rs:14:5 + | +LL | fn to_int(&self) -> isize { *self } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function for candidate #1 + | +LL | ToPrimitive::to_int(&self) + other.to_int() + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +help: disambiguate the associated function for candidate #2 + | +LL | Add::to_int(&self) + other.to_int() + | ~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/issues/issue-3702.rs b/tests/ui/issues/issue-3702.rs new file mode 100644 index 000000000..f48d549b3 --- /dev/null +++ b/tests/ui/issues/issue-3702.rs @@ -0,0 +1,13 @@ +// run-pass +#![allow(dead_code)] + +pub fn main() { + trait Text { + fn to_string(&self) -> String; + } + + fn to_string(t: Box<dyn Text>) { + println!("{}", (*t).to_string()); + } + +} diff --git a/tests/ui/issues/issue-37051.rs b/tests/ui/issues/issue-37051.rs new file mode 100644 index 000000000..9cae6cf5e --- /dev/null +++ b/tests/ui/issues/issue-37051.rs @@ -0,0 +1,18 @@ +// check-pass + +#![feature(associated_type_defaults)] + +trait State: Sized { + type NextState: State = StateMachineEnded; + fn execute(self) -> Option<Self::NextState>; +} + +struct StateMachineEnded; + +impl State for StateMachineEnded { + fn execute(self) -> Option<Self::NextState> { + None + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-3707.rs b/tests/ui/issues/issue-3707.rs new file mode 100644 index 000000000..0817c51ee --- /dev/null +++ b/tests/ui/issues/issue-3707.rs @@ -0,0 +1,18 @@ +struct Obj { + member: usize +} + +impl Obj { + pub fn boom() -> bool { + return 1+1 == 2 + } + pub fn chirp(&self) { + self.boom(); //~ ERROR no method named `boom` found + } +} + +fn main() { + let o = Obj { member: 0 }; + o.chirp(); + 1 + 1; +} diff --git a/tests/ui/issues/issue-3707.stderr b/tests/ui/issues/issue-3707.stderr new file mode 100644 index 000000000..07c8101cb --- /dev/null +++ b/tests/ui/issues/issue-3707.stderr @@ -0,0 +1,19 @@ +error[E0599]: no method named `boom` found for reference `&Obj` in the current scope + --> $DIR/issue-3707.rs:10:14 + | +LL | self.boom(); + | -----^^^^-- + | | | + | | this is an associated function, not a method + | help: use associated function syntax instead: `Obj::boom()` + | + = note: found the following associated functions; to be used as methods, functions must have a `self` parameter +note: the candidate is defined in an impl for the type `Obj` + --> $DIR/issue-3707.rs:6:5 + | +LL | pub fn boom() -> bool { + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-37109.rs b/tests/ui/issues/issue-37109.rs new file mode 100644 index 000000000..1e57d5f95 --- /dev/null +++ b/tests/ui/issues/issue-37109.rs @@ -0,0 +1,16 @@ +// run-pass +trait ToRef<'a> { + type Ref: 'a; +} + +impl<'a, U: 'a> ToRef<'a> for U { + type Ref = &'a U; +} + +fn example<'a, T>(value: &'a T) -> (<T as ToRef<'a>>::Ref, u32) { + (value, 0) +} + +fn main() { + example(&0); +} diff --git a/tests/ui/issues/issue-37131.rs b/tests/ui/issues/issue-37131.rs new file mode 100644 index 000000000..ac2d1d1ed --- /dev/null +++ b/tests/ui/issues/issue-37131.rs @@ -0,0 +1,9 @@ +// Tests that compiling for a target which is not installed will result in a helpful +// error message. + +// compile-flags: --target=thumbv6m-none-eabi +// ignore-arm +// needs-llvm-components: arm + +// error-pattern:target may not be installed +fn main() { } diff --git a/tests/ui/issues/issue-37131.stderr b/tests/ui/issues/issue-37131.stderr new file mode 100644 index 000000000..9ecae3e7a --- /dev/null +++ b/tests/ui/issues/issue-37131.stderr @@ -0,0 +1,11 @@ +error[E0463]: can't find crate for `std` + | + = note: the `thumbv6m-none-eabi` target may not be installed + = help: consider downloading the target with `rustup target add thumbv6m-none-eabi` + = help: consider building the standard library from source with `cargo build -Zbuild-std` + +error: requires `sized` lang_item + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0463`. diff --git a/tests/ui/issues/issue-37291/auxiliary/lib.rs b/tests/ui/issues/issue-37291/auxiliary/lib.rs new file mode 100644 index 000000000..1b163ee13 --- /dev/null +++ b/tests/ui/issues/issue-37291/auxiliary/lib.rs @@ -0,0 +1,42 @@ +#![crate_type = "lib"] + +use std::ops::Mul; + +pub trait A {} +pub trait B { + type AT: A; +} +pub trait C { + type BT: B; +} + +pub struct AV; +impl A for AV {} + +pub struct BV; +impl B for BV { + type AT = AV; +} + +pub struct CV; +impl C for CV { + type BT = BV; +} + +pub struct WrapperB<T>(pub T); +pub struct WrapperC<T>(pub T); + +impl<C1> Mul<WrapperB<<C1::BT as B>::AT>> for WrapperC<C1> + where C1: C +{ + type Output = u8; + fn mul(self, _: WrapperB<<C1::BT as B>::AT>) -> Self::Output { + loop {} + } +} +impl<C1> Mul<WrapperC<C1>> for WrapperC<C1> { + type Output = u8; + fn mul(self, _: WrapperC<C1>) -> Self::Output { + loop {} + } +} diff --git a/tests/ui/issues/issue-37291/main.rs b/tests/ui/issues/issue-37291/main.rs new file mode 100644 index 000000000..6fb6b50da --- /dev/null +++ b/tests/ui/issues/issue-37291/main.rs @@ -0,0 +1,21 @@ +// run-pass +#![allow(unused_imports)] +// aux-build:lib.rs + +// Regression test for #37291. The problem was that the starting +// environment for a specialization check was not including the +// where-clauses from the impl when attempting to normalize the impl's +// trait-ref, so things like `<C as Foo>::Item` could not resolve, +// since the `C: Foo` trait bound was not included in the environment. + +extern crate lib; + +use lib::{CV, WrapperB, WrapperC}; + +fn main() { + let a = WrapperC(CV); + let b = WrapperC(CV); + if false { + let _ = a * b; + } +} diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.polonius.stderr b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.polonius.stderr new file mode 100644 index 000000000..3a1c0b82c --- /dev/null +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.polonius.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(.....), ...), ...) as Foo>::recurse` + --> $DIR/issue-37311.rs:17:9 + | +LL | (self, self).recurse(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `<T as Foo>::recurse` defined here + --> $DIR/issue-37311.rs:16:5 + | +LL | fn recurse(&self) { + | ^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-37311-type-length-limit/issue-37311.polonius/issue-37311.long-type.txt' + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs new file mode 100644 index 000000000..50d1f166c --- /dev/null +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs @@ -0,0 +1,23 @@ +// build-fail +// normalize-stderr-test: ".nll/" -> "/" + +trait Mirror { + type Image; +} + +impl<T> Mirror for T { type Image = T; } + +trait Foo { + fn recurse(&self); +} + +impl<T> Foo for T { + #[allow(unconditional_recursion)] + fn recurse(&self) { + (self, self).recurse(); //~ ERROR reached the recursion limit + } +} + +fn main() { + ().recurse(); +} diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr new file mode 100644 index 000000000..5b8299fe8 --- /dev/null +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -0,0 +1,15 @@ +error: reached the recursion limit while instantiating `<(&(&(..., ...), ...), ...) as Foo>::recurse` + --> $DIR/issue-37311.rs:17:9 + | +LL | (self, self).recurse(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `<T as Foo>::recurse` defined here + --> $DIR/issue-37311.rs:16:5 + | +LL | fn recurse(&self) { + | ^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-37311-type-length-limit/issue-37311/issue-37311.long-type.txt' + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-3743.rs b/tests/ui/issues/issue-3743.rs new file mode 100644 index 000000000..07741914f --- /dev/null +++ b/tests/ui/issues/issue-3743.rs @@ -0,0 +1,55 @@ +// run-pass +// If `Mul` used an associated type for its output, this test would +// work more smoothly. + +use std::ops::Mul; + +#[derive(Copy, Clone)] +struct Vec2 { + x: f64, + y: f64 +} + +// methods we want to export as methods as well as operators +impl Vec2 { +#[inline(always)] + fn vmul(self, other: f64) -> Vec2 { + Vec2 { x: self.x * other, y: self.y * other } + } +} + +// Right-hand-side operator visitor pattern +trait RhsOfVec2Mul { + type Result; + + fn mul_vec2_by(&self, lhs: &Vec2) -> Self::Result; +} + +// Vec2's implementation of Mul "from the other side" using the above trait +impl<Res, Rhs: RhsOfVec2Mul<Result=Res>> Mul<Rhs> for Vec2 { + type Output = Res; + + fn mul(self, rhs: Rhs) -> Res { rhs.mul_vec2_by(&self) } +} + +// Implementation of 'f64 as right-hand-side of Vec2::Mul' +impl RhsOfVec2Mul for f64 { + type Result = Vec2; + + fn mul_vec2_by(&self, lhs: &Vec2) -> Vec2 { lhs.vmul(*self) } +} + +// Usage with failing inference +pub fn main() { + let a = Vec2 { x: 3.0f64, y: 4.0f64 }; + + // the following compiles and works properly + let v1: Vec2 = a * 3.0f64; + println!("{} {}", v1.x, v1.y); + + // the following compiles but v2 will not be Vec2 yet and + // using it later will cause an error that the type of v2 + // must be known + let v2 = a * 3.0f64; + println!("{} {}", v2.x, v2.y); // error regarding v2's type +} diff --git a/tests/ui/issues/issue-37510.rs b/tests/ui/issues/issue-37510.rs new file mode 100644 index 000000000..2081c9f7e --- /dev/null +++ b/tests/ui/issues/issue-37510.rs @@ -0,0 +1,14 @@ +// check-pass + +fn foo(_: &mut i32) -> bool { true } + +fn main() { + let opt = Some(92); + let mut x = 62; + + if let Some(_) = opt { + + } else if foo(&mut x) { + + } +} diff --git a/tests/ui/issues/issue-3753.rs b/tests/ui/issues/issue-3753.rs new file mode 100644 index 000000000..dc9e42bad --- /dev/null +++ b/tests/ui/issues/issue-3753.rs @@ -0,0 +1,32 @@ +// run-pass +// Issue #3656 +// Issue Name: pub method preceded by attribute can't be parsed +// Abstract: Visibility parsing failed when compiler parsing + +use std::f64; + +#[derive(Copy, Clone)] +pub struct Point { + x: f64, + y: f64 +} + +#[derive(Copy, Clone)] +pub enum Shape { + Circle(Point, f64), + Rectangle(Point, Point) +} + +impl Shape { + pub fn area(&self, sh: Shape) -> f64 { + match sh { + Shape::Circle(_, size) => f64::consts::PI * size * size, + Shape::Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y) + } + } +} + +pub fn main(){ + let s = Shape::Circle(Point { x: 1.0, y: 2.0 }, 3.0); + println!("{}", s.area(s)); +} diff --git a/tests/ui/issues/issue-37534.rs b/tests/ui/issues/issue-37534.rs new file mode 100644 index 000000000..1e67e9a81 --- /dev/null +++ b/tests/ui/issues/issue-37534.rs @@ -0,0 +1,6 @@ +struct Foo<T: ?Hash> { } +//~^ ERROR expected trait, found derive macro `Hash` +//~^^ ERROR parameter `T` is never used +//~^^^ WARN default bound relaxed for a type parameter, but this does nothing + +fn main() { } diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr new file mode 100644 index 000000000..895479986 --- /dev/null +++ b/tests/ui/issues/issue-37534.stderr @@ -0,0 +1,29 @@ +error[E0404]: expected trait, found derive macro `Hash` + --> $DIR/issue-37534.rs:1:16 + | +LL | struct Foo<T: ?Hash> { } + | ^^^^ not a trait + | +help: consider importing this trait instead + | +LL | use std::hash::Hash; + | + +warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported + --> $DIR/issue-37534.rs:1:12 + | +LL | struct Foo<T: ?Hash> { } + | ^ + +error[E0392]: parameter `T` is never used + --> $DIR/issue-37534.rs:1:12 + | +LL | struct Foo<T: ?Hash> { } + | ^ unused parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 2 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0392, E0404. +For more information about an error, try `rustc --explain E0392`. diff --git a/tests/ui/issues/issue-37576.rs b/tests/ui/issues/issue-37576.rs new file mode 100644 index 000000000..e7f933ab2 --- /dev/null +++ b/tests/ui/issues/issue-37576.rs @@ -0,0 +1,45 @@ +fn main() { + 'test_1: while break 'test_1 {} + while break {} + //~^ ERROR `break` or `continue` with no label + + 'test_2: while let true = break 'test_2 {} + while let true = break {} + //~^ ERROR `break` or `continue` with no label + + loop { 'test_3: while break 'test_3 {} } + loop { while break {} } + //~^ ERROR `break` or `continue` with no label + + loop { + 'test_4: while break 'test_4 {} + break; + } + loop { + while break {} + //~^ ERROR `break` or `continue` with no label + break; + } + + 'test_5: while continue 'test_5 {} + while continue {} + //~^ ERROR `break` or `continue` with no label + + 'test_6: while let true = continue 'test_6 {} + while let true = continue {} + //~^ ERROR `break` or `continue` with no label + + loop { 'test_7: while continue 'test_7 {} } + loop { while continue {} } + //~^ ERROR `break` or `continue` with no label + + loop { + 'test_8: while continue 'test_8 {} + continue; + } + loop { + while continue {} + //~^ ERROR `break` or `continue` with no label + continue; + } +} diff --git a/tests/ui/issues/issue-37576.stderr b/tests/ui/issues/issue-37576.stderr new file mode 100644 index 000000000..d19e1f453 --- /dev/null +++ b/tests/ui/issues/issue-37576.stderr @@ -0,0 +1,51 @@ +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:3:11 + | +LL | while break {} + | ^^^^^ unlabeled `break` in the condition of a `while` loop + +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:7:22 + | +LL | while let true = break {} + | ^^^^^ unlabeled `break` in the condition of a `while` loop + +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:11:18 + | +LL | loop { while break {} } + | ^^^^^ unlabeled `break` in the condition of a `while` loop + +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:19:15 + | +LL | while break {} + | ^^^^^ unlabeled `break` in the condition of a `while` loop + +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:25:11 + | +LL | while continue {} + | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop + +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:29:22 + | +LL | while let true = continue {} + | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop + +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:33:18 + | +LL | loop { while continue {} } + | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop + +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-37576.rs:41:15 + | +LL | while continue {} + | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0590`. diff --git a/tests/ui/issues/issue-37598.rs b/tests/ui/issues/issue-37598.rs new file mode 100644 index 000000000..458e999c3 --- /dev/null +++ b/tests/ui/issues/issue-37598.rs @@ -0,0 +1,11 @@ +// check-pass + +fn check(list: &[u8]) { + match list { + &[] => {}, + &[_u1, _u2, ref _next @ ..] => {}, + &[_u1] => {}, + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-3763.rs b/tests/ui/issues/issue-3763.rs new file mode 100644 index 000000000..25ad6b319 --- /dev/null +++ b/tests/ui/issues/issue-3763.rs @@ -0,0 +1,29 @@ +// compile-flags: -Zsave-analysis +// Also regression test for #69416 + +mod my_mod { + pub struct MyStruct { + priv_field: isize + } + pub fn MyStruct () -> MyStruct { + MyStruct {priv_field: 4} + } + impl MyStruct { + fn happyfun(&self) {} + } +} + +fn main() { + let my_struct = my_mod::MyStruct(); + let _woohoo = (&my_struct).priv_field; + //~^ ERROR field `priv_field` of struct `MyStruct` is private + + let _woohoo = (Box::new(my_struct)).priv_field; + //~^ ERROR field `priv_field` of struct `MyStruct` is private + + (&my_struct).happyfun(); //~ ERROR associated function `happyfun` is private + + (Box::new(my_struct)).happyfun(); //~ ERROR associated function `happyfun` is private + let nope = my_struct.priv_field; + //~^ ERROR field `priv_field` of struct `MyStruct` is private +} diff --git a/tests/ui/issues/issue-3763.stderr b/tests/ui/issues/issue-3763.stderr new file mode 100644 index 000000000..6f4567546 --- /dev/null +++ b/tests/ui/issues/issue-3763.stderr @@ -0,0 +1,40 @@ +error[E0616]: field `priv_field` of struct `MyStruct` is private + --> $DIR/issue-3763.rs:18:32 + | +LL | let _woohoo = (&my_struct).priv_field; + | ^^^^^^^^^^ private field + +error[E0616]: field `priv_field` of struct `MyStruct` is private + --> $DIR/issue-3763.rs:21:41 + | +LL | let _woohoo = (Box::new(my_struct)).priv_field; + | ^^^^^^^^^^ private field + +error[E0624]: associated function `happyfun` is private + --> $DIR/issue-3763.rs:24:18 + | +LL | fn happyfun(&self) {} + | ------------------ private associated function defined here +... +LL | (&my_struct).happyfun(); + | ^^^^^^^^ private associated function + +error[E0624]: associated function `happyfun` is private + --> $DIR/issue-3763.rs:26:27 + | +LL | fn happyfun(&self) {} + | ------------------ private associated function defined here +... +LL | (Box::new(my_struct)).happyfun(); + | ^^^^^^^^ private associated function + +error[E0616]: field `priv_field` of struct `MyStruct` is private + --> $DIR/issue-3763.rs:27:26 + | +LL | let nope = my_struct.priv_field; + | ^^^^^^^^^^ private field + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0616, E0624. +For more information about an error, try `rustc --explain E0616`. diff --git a/tests/ui/issues/issue-37665.rs b/tests/ui/issues/issue-37665.rs new file mode 100644 index 000000000..81ff478aa --- /dev/null +++ b/tests/ui/issues/issue-37665.rs @@ -0,0 +1,10 @@ +// compile-flags: -Z unpretty=mir + +use std::path::MAIN_SEPARATOR; + +fn main() { + let mut foo : String = "hello".to_string(); + foo.push(MAIN_SEPARATOR); + println!("{}", foo); + let x: () = 0; //~ ERROR: mismatched types +} diff --git a/tests/ui/issues/issue-37665.stderr b/tests/ui/issues/issue-37665.stderr new file mode 100644 index 000000000..1e1f451b4 --- /dev/null +++ b/tests/ui/issues/issue-37665.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/issue-37665.rs:9:17 + | +LL | let x: () = 0; + | -- ^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-37686.rs b/tests/ui/issues/issue-37686.rs new file mode 100644 index 000000000..ba58e9e9d --- /dev/null +++ b/tests/ui/issues/issue-37686.rs @@ -0,0 +1,7 @@ +// run-pass +fn main() { + match (0, 0) { + (usize::MIN, usize::MAX) => {} + _ => {} + } +} diff --git a/tests/ui/issues/issue-37725.rs b/tests/ui/issues/issue-37725.rs new file mode 100644 index 000000000..1c6df0da6 --- /dev/null +++ b/tests/ui/issues/issue-37725.rs @@ -0,0 +1,12 @@ +// build-pass +// compiler-opts: -Zmir-opt-level=2 + +#![allow(dead_code)] +trait Foo { + fn foo(&self); +} + +fn foo<'a>(s: &'a mut ()) where &'a mut (): Foo { + s.foo(); +} +fn main() {} diff --git a/tests/ui/issues/issue-37733.rs b/tests/ui/issues/issue-37733.rs new file mode 100644 index 000000000..e211e2c33 --- /dev/null +++ b/tests/ui/issues/issue-37733.rs @@ -0,0 +1,7 @@ +// build-pass +#![allow(dead_code)] +type A = for<> fn(); + +type B = for<'a,> fn(); + +pub fn main() {} diff --git a/tests/ui/issues/issue-3779.rs b/tests/ui/issues/issue-3779.rs new file mode 100644 index 000000000..901c1be80 --- /dev/null +++ b/tests/ui/issues/issue-3779.rs @@ -0,0 +1,8 @@ +struct S { + //~^ ERROR E0072 + element: Option<S> +} + +fn main() { + let x = S { element: None }; +} diff --git a/tests/ui/issues/issue-3779.stderr b/tests/ui/issues/issue-3779.stderr new file mode 100644 index 000000000..a0dbcc920 --- /dev/null +++ b/tests/ui/issues/issue-3779.stderr @@ -0,0 +1,17 @@ +error[E0072]: recursive type `S` has infinite size + --> $DIR/issue-3779.rs:1:1 + | +LL | struct S { + | ^^^^^^^^ +LL | +LL | element: Option<S> + | - recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | element: Option<Box<S>> + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-37884.rs b/tests/ui/issues/issue-37884.rs new file mode 100644 index 000000000..ee37481b2 --- /dev/null +++ b/tests/ui/issues/issue-37884.rs @@ -0,0 +1,14 @@ +struct RepeatMut<'a, T>(T, &'a ()); + +impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { + + type Item = &'a mut T; + fn next(&'a mut self) -> Option<Self::Item> + //~^ ERROR method not compatible with trait + //~| lifetime mismatch + { + Some(&mut self.0) + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-37884.stderr b/tests/ui/issues/issue-37884.stderr new file mode 100644 index 000000000..7ddb36c8e --- /dev/null +++ b/tests/ui/issues/issue-37884.stderr @@ -0,0 +1,22 @@ +error[E0308]: method not compatible with trait + --> $DIR/issue-37884.rs:6:5 + | +LL | fn next(&'a mut self) -> Option<Self::Item> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected signature `fn(&mut RepeatMut<'a, T>) -> Option<_>` + found signature `fn(&'a mut RepeatMut<'a, T>) -> Option<_>` +note: the anonymous lifetime as defined here... + --> $DIR/issue-37884.rs:6:5 + | +LL | fn next(&'a mut self) -> Option<Self::Item> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...does not necessarily outlive the lifetime `'a` as defined here + --> $DIR/issue-37884.rs:3:6 + | +LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-3794.rs b/tests/ui/issues/issue-3794.rs new file mode 100644 index 000000000..b1f028fbc --- /dev/null +++ b/tests/ui/issues/issue-3794.rs @@ -0,0 +1,32 @@ +// run-pass +#![allow(dead_code)] + +trait T { + fn print(&self); +} + +#[derive(Debug)] +struct S { + s: isize, +} + +impl T for S { + fn print(&self) { + println!("{:?}", self); + } +} + +fn print_t(t: &dyn T) { + t.print(); +} + +fn print_s(s: &S) { + s.print(); +} + +pub fn main() { + let s: Box<S> = Box::new(S { s: 5 }); + print_s(&*s); + let t: Box<dyn T> = s as Box<dyn T>; + print_t(&*t); +} diff --git a/tests/ui/issues/issue-38160.rs b/tests/ui/issues/issue-38160.rs new file mode 100644 index 000000000..0da8b7900 --- /dev/null +++ b/tests/ui/issues/issue-38160.rs @@ -0,0 +1,19 @@ +// check-pass + +trait MyTrait { + const MY_CONST: &'static str; +} + +macro_rules! my_macro { + () => { + struct MyStruct; + + impl MyTrait for MyStruct { + const MY_CONST: &'static str = stringify!(abc); + } + } +} + +my_macro!(); + +fn main() {} diff --git a/tests/ui/issues/issue-38190.rs b/tests/ui/issues/issue-38190.rs new file mode 100644 index 000000000..cfa0420c8 --- /dev/null +++ b/tests/ui/issues/issue-38190.rs @@ -0,0 +1,15 @@ +// run-pass +// aux-build:issue-38190.rs +// ignore-pretty issue #37195 + +#[macro_use] +extern crate issue_38190; + +mod auxiliary { + m!([ + #[path = "issue-38190.rs"] + mod issue_38190; + ]); +} + +fn main() {} diff --git a/tests/ui/issues/issue-38226.rs b/tests/ui/issues/issue-38226.rs new file mode 100644 index 000000000..3213e3618 --- /dev/null +++ b/tests/ui/issues/issue-38226.rs @@ -0,0 +1,15 @@ +// run-pass +// This test makes sure that we don't run into a linker error because of the +// middle::reachable pass missing trait methods with default impls. + +// aux-build:issue-38226-aux.rs + +// Need -Cno-prepopulate-passes to really disable inlining, otherwise the faulty +// code gets optimized out: +// compile-flags: -Cno-prepopulate-passes -Cpasses=name-anon-globals + +extern crate issue_38226_aux; + +fn main() { + issue_38226_aux::foo::<()>(); +} diff --git a/tests/ui/issues/issue-38381.rs b/tests/ui/issues/issue-38381.rs new file mode 100644 index 000000000..82d4a4e32 --- /dev/null +++ b/tests/ui/issues/issue-38381.rs @@ -0,0 +1,7 @@ +// check-pass + +use std::ops::Deref; + +fn main() { + let _x: fn(&i32) -> <&i32 as Deref>::Target = unimplemented!(); +} diff --git a/tests/ui/issues/issue-38412.rs b/tests/ui/issues/issue-38412.rs new file mode 100644 index 000000000..96bd93af5 --- /dev/null +++ b/tests/ui/issues/issue-38412.rs @@ -0,0 +1,10 @@ +fn main() { + let Box(a) = loop { }; + //~^ ERROR cannot match against a tuple struct which contains private fields + + // (The below is a trick to allow compiler to infer a type for + // variable `a` without attempting to ascribe a type to the + // pattern or otherwise attempting to name the Box type, which + // would run afoul of issue #22207) + let _b: *mut i32 = *a; +} diff --git a/tests/ui/issues/issue-38412.stderr b/tests/ui/issues/issue-38412.stderr new file mode 100644 index 000000000..610696f84 --- /dev/null +++ b/tests/ui/issues/issue-38412.stderr @@ -0,0 +1,9 @@ +error[E0532]: cannot match against a tuple struct which contains private fields + --> $DIR/issue-38412.rs:2:9 + | +LL | let Box(a) = loop { }; + | ^^^ constructor is not visible here due to private fields + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/issues/issue-38437.rs b/tests/ui/issues/issue-38437.rs new file mode 100644 index 000000000..e14121690 --- /dev/null +++ b/tests/ui/issues/issue-38437.rs @@ -0,0 +1,46 @@ +// run-pass +#![allow(dead_code)] +// Check that drop elaboration clears the "master" discriminant +// drop flag even if it protects no fields. + +struct Good(usize); +impl Drop for Good { + #[inline(never)] + fn drop(&mut self) { + println!("dropping Good({})", self.0); + } +} + +struct Void; +impl Drop for Void { + #[inline(never)] + fn drop(&mut self) { + panic!("Suddenly, a Void appears."); + } +} + +enum E { + Never(Void), + Fine(Good) +} + +fn main() { + let mut go = true; + + loop { + let next; + match go { + true => next = E::Fine(Good(123)), + false => return, + } + + match next { + E::Never(_) => return, + E::Fine(_good) => go = false, + } + + // `next` is dropped and StorageDead'd here. We must reset the + // discriminant's drop flag to avoid random variants being + // dropped. + } +} diff --git a/tests/ui/issues/issue-38458.rs b/tests/ui/issues/issue-38458.rs new file mode 100644 index 000000000..665a8fdf8 --- /dev/null +++ b/tests/ui/issues/issue-38458.rs @@ -0,0 +1,5 @@ +const x: () = { + return; //~ ERROR return statement outside of function body +}; + +fn main() {} diff --git a/tests/ui/issues/issue-38458.stderr b/tests/ui/issues/issue-38458.stderr new file mode 100644 index 000000000..c04a01118 --- /dev/null +++ b/tests/ui/issues/issue-38458.stderr @@ -0,0 +1,9 @@ +error[E0572]: return statement outside of function body + --> $DIR/issue-38458.rs:2:5 + | +LL | return; + | ^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0572`. diff --git a/tests/ui/issues/issue-3847.rs b/tests/ui/issues/issue-3847.rs new file mode 100644 index 000000000..16e0b00b3 --- /dev/null +++ b/tests/ui/issues/issue-3847.rs @@ -0,0 +1,13 @@ +// run-pass +mod buildings { + pub struct Tower { pub height: usize } +} + +pub fn main() { + let sears = buildings::Tower { height: 1451 }; + let h: usize = match sears { + buildings::Tower { height: h } => { h } + }; + + println!("{}", h); +} diff --git a/tests/ui/issues/issue-38556.rs b/tests/ui/issues/issue-38556.rs new file mode 100644 index 000000000..63fd9db08 --- /dev/null +++ b/tests/ui/issues/issue-38556.rs @@ -0,0 +1,13 @@ +// run-pass +#![allow(dead_code)] +pub struct Foo; + +macro_rules! reexport { + () => { use Foo as Bar; } +} + +reexport!(); + +fn main() { + fn f(_: Bar) {} +} diff --git a/tests/ui/issues/issue-38727.rs b/tests/ui/issues/issue-38727.rs new file mode 100644 index 000000000..2d418b652 --- /dev/null +++ b/tests/ui/issues/issue-38727.rs @@ -0,0 +1,13 @@ +// build-pass +#![allow(dead_code)] +#[repr(u64)] +enum A { + A = 0u64, + B = !0u64, +} + +fn cmp() -> A { + A::B +} + +fn main() {} diff --git a/tests/ui/issues/issue-3874.rs b/tests/ui/issues/issue-3874.rs new file mode 100644 index 000000000..f9553d88d --- /dev/null +++ b/tests/ui/issues/issue-3874.rs @@ -0,0 +1,12 @@ +// build-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +enum PureCounter { PureCounterVariant(usize) } + +fn each<F>(thing: PureCounter, blk: F) where F: FnOnce(&usize) { + let PureCounter::PureCounterVariant(ref x) = thing; + blk(x); +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-38763.rs b/tests/ui/issues/issue-38763.rs new file mode 100644 index 000000000..a966cf217 --- /dev/null +++ b/tests/ui/issues/issue-38763.rs @@ -0,0 +1,13 @@ +// run-pass +// ignore-emscripten + +#[repr(C)] +pub struct Foo(i128); + +#[no_mangle] +#[allow(improper_ctypes_definitions)] +pub extern "C" fn foo(x: Foo) -> Foo { x } + +fn main() { + foo(Foo(1)); +} diff --git a/tests/ui/issues/issue-3878.rs b/tests/ui/issues/issue-3878.rs new file mode 100644 index 000000000..6de3405af --- /dev/null +++ b/tests/ui/issues/issue-3878.rs @@ -0,0 +1,9 @@ +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(path_statements)] + +pub fn main() { + let y: Box<_> = Box::new(1); + y; +} diff --git a/tests/ui/issues/issue-38821.rs b/tests/ui/issues/issue-38821.rs new file mode 100644 index 000000000..6753860e9 --- /dev/null +++ b/tests/ui/issues/issue-38821.rs @@ -0,0 +1,33 @@ +pub struct Nullable<T: NotNull>(T); + +pub trait NotNull {} + +pub trait IntoNullable { + type Nullable; +} + +impl<T: NotNull> IntoNullable for T { + type Nullable = Nullable<T>; +} + +impl<T: NotNull> IntoNullable for Nullable<T> { + type Nullable = Nullable<T>; +} + +pub trait Expression { + type SqlType; +} + +pub trait Column: Expression {} + +#[derive(Debug, Copy, Clone)] +//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied +pub enum ColumnInsertValue<Col, Expr> where + Col: Column, + Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, +{ + Expression(Col, Expr), + Default(Col), +} + +fn main() {} diff --git a/tests/ui/issues/issue-38821.stderr b/tests/ui/issues/issue-38821.stderr new file mode 100644 index 000000000..a52a9c138 --- /dev/null +++ b/tests/ui/issues/issue-38821.stderr @@ -0,0 +1,22 @@ +error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied + --> $DIR/issue-38821.rs:23:17 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` + | +note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` + --> $DIR/issue-38821.rs:9:18 + | +LL | impl<T: NotNull> IntoNullable for T { + | ------- ^^^^^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting the associated type + | +LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull, + | +++++++++++++++++++++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-38857.rs b/tests/ui/issues/issue-38857.rs new file mode 100644 index 000000000..81d881c10 --- /dev/null +++ b/tests/ui/issues/issue-38857.rs @@ -0,0 +1,5 @@ +fn main() { + let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; + //~^ ERROR failed to resolve: could not find `imp` in `sys` [E0433] + //~^^ ERROR module `sys` is private [E0603] +} diff --git a/tests/ui/issues/issue-38857.stderr b/tests/ui/issues/issue-38857.stderr new file mode 100644 index 000000000..4d505784b --- /dev/null +++ b/tests/ui/issues/issue-38857.stderr @@ -0,0 +1,19 @@ +error[E0433]: failed to resolve: could not find `imp` in `sys` + --> $DIR/issue-38857.rs:2:23 + | +LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; + | ^^^ could not find `imp` in `sys` + +error[E0603]: module `sys` is private + --> $DIR/issue-38857.rs:2:18 + | +LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; + | ^^^ private module + | +note: the module `sys` is defined here + --> $SRC_DIR/std/src/lib.rs:LL:COL + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0433, E0603. +For more information about an error, try `rustc --explain E0433`. diff --git a/tests/ui/issues/issue-38875/auxiliary/issue-38875-b.rs b/tests/ui/issues/issue-38875/auxiliary/issue-38875-b.rs new file mode 100644 index 000000000..e9f7fefb6 --- /dev/null +++ b/tests/ui/issues/issue-38875/auxiliary/issue-38875-b.rs @@ -0,0 +1 @@ +pub const FOO: usize = *&0; diff --git a/tests/ui/issues/issue-38875/issue-38875.rs b/tests/ui/issues/issue-38875/issue-38875.rs new file mode 100644 index 000000000..124e4d6fd --- /dev/null +++ b/tests/ui/issues/issue-38875/issue-38875.rs @@ -0,0 +1,8 @@ +// aux-build:issue-38875-b.rs +// check-pass + +extern crate issue_38875_b; + +fn main() { + let test_x = [0; issue_38875_b::FOO]; +} diff --git a/tests/ui/issues/issue-3888-2.rs b/tests/ui/issues/issue-3888-2.rs new file mode 100644 index 000000000..d1ef914bd --- /dev/null +++ b/tests/ui/issues/issue-3888-2.rs @@ -0,0 +1,9 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] { + &v[1..5] +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-38919.rs b/tests/ui/issues/issue-38919.rs new file mode 100644 index 000000000..3d28f1936 --- /dev/null +++ b/tests/ui/issues/issue-38919.rs @@ -0,0 +1,5 @@ +fn foo<T: Iterator>() { + T::Item; //~ ERROR no associated item named `Item` found +} + +fn main() { } diff --git a/tests/ui/issues/issue-38919.stderr b/tests/ui/issues/issue-38919.stderr new file mode 100644 index 000000000..f9ab8a515 --- /dev/null +++ b/tests/ui/issues/issue-38919.stderr @@ -0,0 +1,11 @@ +error[E0599]: no associated item named `Item` found for type parameter `T` in the current scope + --> $DIR/issue-38919.rs:2:8 + | +LL | fn foo<T: Iterator>() { + | - associated item `Item` not found for this type parameter +LL | T::Item; + | ^^^^ associated item not found in `T` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-38942.rs b/tests/ui/issues/issue-38942.rs new file mode 100644 index 000000000..308bdd6e2 --- /dev/null +++ b/tests/ui/issues/issue-38942.rs @@ -0,0 +1,17 @@ +// run-pass +// See https://github.com/rust-lang/rust/issues/38942 + +#[repr(u64)] +pub enum NSEventType { + NSEventTypePressure, +} + +pub const A: u64 = NSEventType::NSEventTypePressure as u64; + +fn banana() -> u64 { + A +} + +fn main() { + println!("banana! {}", banana()); +} diff --git a/tests/ui/issues/issue-3895.rs b/tests/ui/issues/issue-3895.rs new file mode 100644 index 000000000..c560ca60d --- /dev/null +++ b/tests/ui/issues/issue-3895.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] + +pub fn main() { + enum State { BadChar, BadSyntax } + + match State::BadChar { + _ if true => State::BadChar, + State::BadChar | State::BadSyntax => panic!() , + }; +} diff --git a/tests/ui/issues/issue-38954.rs b/tests/ui/issues/issue-38954.rs new file mode 100644 index 000000000..61df411b1 --- /dev/null +++ b/tests/ui/issues/issue-38954.rs @@ -0,0 +1,4 @@ +fn _test(ref _p: str) {} +//~^ ERROR the size for values of type + +fn main() { } diff --git a/tests/ui/issues/issue-38954.stderr b/tests/ui/issues/issue-38954.stderr new file mode 100644 index 000000000..ab15bb1af --- /dev/null +++ b/tests/ui/issues/issue-38954.stderr @@ -0,0 +1,16 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/issue-38954.rs:1:10 + | +LL | fn _test(ref _p: str) {} + | ^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = help: unsized fn params are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn _test(ref _p: &str) {} + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-38987.rs b/tests/ui/issues/issue-38987.rs new file mode 100644 index 000000000..cb4e1b0d4 --- /dev/null +++ b/tests/ui/issues/issue-38987.rs @@ -0,0 +1,4 @@ +// run-pass +fn main() { + let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128; +} diff --git a/tests/ui/issues/issue-39089.rs b/tests/ui/issues/issue-39089.rs new file mode 100644 index 000000000..c7d4f8bd3 --- /dev/null +++ b/tests/ui/issues/issue-39089.rs @@ -0,0 +1,5 @@ +// check-pass +#![allow(dead_code)] +fn f<T: ?for<'a> Sized>() {} + +fn main() {} diff --git a/tests/ui/issues/issue-39175.rs b/tests/ui/issues/issue-39175.rs new file mode 100644 index 000000000..3866e0651 --- /dev/null +++ b/tests/ui/issues/issue-39175.rs @@ -0,0 +1,16 @@ +// This test ignores some platforms as the particular extension trait used +// to demonstrate the issue is only available on unix. This is fine as +// the fix to suggested paths is not platform-dependent and will apply on +// these platforms also. + +// ignore-windows +// ignore-emscripten +// ignore-sgx no processes + +use std::process::Command; +// use std::os::unix::process::CommandExt; + +fn main() { + Command::new("echo").arg("hello").exec(); +//~^ ERROR no method named `exec` +} diff --git a/tests/ui/issues/issue-39175.stderr b/tests/ui/issues/issue-39175.stderr new file mode 100644 index 000000000..afceae82e --- /dev/null +++ b/tests/ui/issues/issue-39175.stderr @@ -0,0 +1,15 @@ +error[E0599]: no method named `exec` found for mutable reference `&mut Command` in the current scope + --> $DIR/issue-39175.rs:14:39 + | +LL | Command::new("echo").arg("hello").exec(); + | ^^^^ method not found in `&mut Command` + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use std::os::unix::process::CommandExt; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-39211.rs b/tests/ui/issues/issue-39211.rs new file mode 100644 index 000000000..6f3834d51 --- /dev/null +++ b/tests/ui/issues/issue-39211.rs @@ -0,0 +1,13 @@ +trait VecN { + const DIM: usize; +} +trait Mat { + type Row: VecN; +} + +fn m<M: Mat>() { + let a = [3; M::Row::DIM]; + //~^ ERROR constant expression depends on a generic parameter +} +fn main() { +} diff --git a/tests/ui/issues/issue-39211.stderr b/tests/ui/issues/issue-39211.stderr new file mode 100644 index 000000000..cd2a014bb --- /dev/null +++ b/tests/ui/issues/issue-39211.stderr @@ -0,0 +1,10 @@ +error: constant expression depends on a generic parameter + --> $DIR/issue-39211.rs:9:17 + | +LL | let a = [3; M::Row::DIM]; + | ^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-39292.rs b/tests/ui/issues/issue-39292.rs new file mode 100644 index 000000000..968cf0891 --- /dev/null +++ b/tests/ui/issues/issue-39292.rs @@ -0,0 +1,17 @@ +// run-pass +// Regression test for issue #39292. The object vtable was being +// incorrectly left with a null pointer. + +trait Foo<T> { + fn print<'a>(&'a self) where T: 'a { println!("foo"); } +} + +impl<'a> Foo<&'a ()> for () { } + +trait Bar: for<'a> Foo<&'a ()> { } + +impl Bar for () {} + +fn main() { + (&() as &dyn Bar).print(); // Segfault +} diff --git a/tests/ui/issues/issue-39367.rs b/tests/ui/issues/issue-39367.rs new file mode 100644 index 000000000..e7beb8a03 --- /dev/null +++ b/tests/ui/issues/issue-39367.rs @@ -0,0 +1,42 @@ +// run-pass +// revisions: mir thir +// [thir]compile-flags: -Zthir-unsafeck + +use std::ops::Deref; + +struct ArenaSet<U: Deref, V=<U as Deref>::Target>(U, &'static V) + where V: 'static + ?Sized; + +static Z: [u8; 4] = [1,2,3,4]; + +fn arena() -> &'static ArenaSet<Vec<u8>> { + fn __static_ref_initialize() -> ArenaSet<Vec<u8>> { + ArenaSet(vec![], &Z) + } + unsafe { + use std::sync::Once; + fn require_sync<T: Sync>(_: &T) { } + unsafe fn __stability() -> &'static ArenaSet<Vec<u8>> { + use std::mem::transmute; + static mut DATA: *const ArenaSet<Vec<u8>> = std::ptr::null_mut(); + + static mut ONCE: Once = Once::new(); + ONCE.call_once(|| { + DATA = transmute + ::<Box<ArenaSet<Vec<u8>>>, *const ArenaSet<Vec<u8>>> + (Box::new(__static_ref_initialize())); + }); + + &*DATA + } + let static_ref = __stability(); + require_sync(static_ref); + static_ref + } +} + +fn main() { + let &ArenaSet(ref u, v) = arena(); + assert!(u.is_empty()); + assert_eq!(v, Z); +} diff --git a/tests/ui/issues/issue-39467.rs b/tests/ui/issues/issue-39467.rs new file mode 100644 index 000000000..397751e4e --- /dev/null +++ b/tests/ui/issues/issue-39467.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(dead_code)] +macro_rules! expr { () => { () } } + +enum A {} + +impl A { + const A: () = expr!(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-39548.rs b/tests/ui/issues/issue-39548.rs new file mode 100644 index 000000000..304e37bf3 --- /dev/null +++ b/tests/ui/issues/issue-39548.rs @@ -0,0 +1,6 @@ +// run-pass +type Array = [(); ((1 < 2) == false) as usize]; + +fn main() { + let _: Array = []; +} diff --git a/tests/ui/issues/issue-39687.rs b/tests/ui/issues/issue-39687.rs new file mode 100644 index 000000000..cbb721fbb --- /dev/null +++ b/tests/ui/issues/issue-39687.rs @@ -0,0 +1,6 @@ +#![feature(fn_traits)] + +fn main() { + <fn() as Fn()>::call; + //~^ ERROR associated type bindings are not allowed here [E0229] +} diff --git a/tests/ui/issues/issue-39687.stderr b/tests/ui/issues/issue-39687.stderr new file mode 100644 index 000000000..b1b3041ea --- /dev/null +++ b/tests/ui/issues/issue-39687.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-39687.rs:4:14 + | +LL | <fn() as Fn()>::call; + | ^^^^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/issues/issue-39709.rs b/tests/ui/issues/issue-39709.rs new file mode 100644 index 000000000..69ef2700e --- /dev/null +++ b/tests/ui/issues/issue-39709.rs @@ -0,0 +1,5 @@ +// run-pass +#![allow(unused_macros)] +fn main() { + println!("{}", { macro_rules! x { ($(t:tt)*) => {} } 33 }); +} diff --git a/tests/ui/issues/issue-3979-2.rs b/tests/ui/issues/issue-3979-2.rs new file mode 100644 index 000000000..4ec128a45 --- /dev/null +++ b/tests/ui/issues/issue-3979-2.rs @@ -0,0 +1,18 @@ +// check-pass +// pretty-expanded FIXME #23616 + +trait A { + fn a_method(&self); +} + +trait B: A { + fn b_method(&self); +} + +trait C: B { + fn c_method(&self) { + self.a_method(); + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-3979-generics.rs b/tests/ui/issues/issue-3979-generics.rs new file mode 100644 index 000000000..519de1cad --- /dev/null +++ b/tests/ui/issues/issue-3979-generics.rs @@ -0,0 +1,36 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_snake_case)] + +use std::ops::Add; + +trait Positioned<S> { + fn SetX(&mut self, _: S); + fn X(&self) -> S; +} + +trait Movable<S: Add<Output=S>>: Positioned<S> { + fn translate(&mut self, dx: S) { + let x = self.X() + dx; + self.SetX(x); + } +} + +struct Point { x: isize, y: isize } + +impl Positioned<isize> for Point { + fn SetX(&mut self, x: isize) { + self.x = x; + } + fn X(&self) -> isize { + self.x + } +} + +impl Movable<isize> for Point {} + +pub fn main() { + let mut p = Point{ x: 1, y: 2}; + p.translate(3); + assert_eq!(p.X(), 4); +} diff --git a/tests/ui/issues/issue-3979-xcrate.rs b/tests/ui/issues/issue-3979-xcrate.rs new file mode 100644 index 000000000..fcb1f55c3 --- /dev/null +++ b/tests/ui/issues/issue-3979-xcrate.rs @@ -0,0 +1,25 @@ +// run-pass +#![allow(dead_code)] +// aux-build:issue-3979-traits.rs + +extern crate issue_3979_traits; +use issue_3979_traits::{Positioned, Movable}; + +struct Point { x: isize, y: isize } + +impl Positioned for Point { + fn SetX(&mut self, x: isize) { + self.x = x; + } + fn X(&self) -> isize { + self.x + } +} + +impl Movable for Point {} + +pub fn main() { + let mut p = Point{ x: 1, y: 2}; + p.translate(3); + assert_eq!(p.X(), 4); +} diff --git a/tests/ui/issues/issue-3979.rs b/tests/ui/issues/issue-3979.rs new file mode 100644 index 000000000..72949d8c7 --- /dev/null +++ b/tests/ui/issues/issue-3979.rs @@ -0,0 +1,34 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_snake_case)] + +trait Positioned { + fn SetX(&mut self, _: isize); + fn X(&self) -> isize; +} + +trait Movable: Positioned { + fn translate(&mut self, dx: isize) { + let x = self.X(); + self.SetX(x + dx); + } +} + +struct Point { x: isize, y: isize } + +impl Positioned for Point { + fn SetX(&mut self, x: isize) { + self.x = x; + } + fn X(&self) -> isize { + self.x + } +} + +impl Movable for Point {} + +pub fn main() { + let mut p = Point{ x: 1, y: 2}; + p.translate(3); + assert_eq!(p.X(), 4); +} diff --git a/tests/ui/issues/issue-39808.rs b/tests/ui/issues/issue-39808.rs new file mode 100644 index 000000000..a47013673 --- /dev/null +++ b/tests/ui/issues/issue-39808.rs @@ -0,0 +1,17 @@ +// run-pass +#![allow(unreachable_code)] + +// Regression test for #39808. The type parameter of `Owned` was +// considered to be "unconstrained" because the type resulting from +// `format!` (`String`) was not being propagated upward, owing to the +// fact that the expression diverges. + +use std::borrow::Cow; + +fn main() { + let _ = if false { + Cow::Owned(format!("{:?}", panic!())) + } else { + Cow::Borrowed("") + }; +} diff --git a/tests/ui/issues/issue-39827.rs b/tests/ui/issues/issue-39827.rs new file mode 100644 index 000000000..782c668c8 --- /dev/null +++ b/tests/ui/issues/issue-39827.rs @@ -0,0 +1,34 @@ +// run-pass +#![feature(core_intrinsics)] + +use std::intrinsics::{ volatile_copy_memory, volatile_store, volatile_load, + volatile_copy_nonoverlapping_memory, + volatile_set_memory }; + +// +// This test ensures that volatile intrinsics can be specialised with +// zero-sized types and, in case of copy/set functions, can accept +// number of elements equal to zero. +// +fn main () { + let mut dst_pair = (1, 2); + let src_pair = (3, 4); + let mut dst_empty = (); + let src_empty = (); + + const COUNT_0: usize = 0; + const COUNT_100: usize = 100; + + unsafe { + volatile_copy_memory(&mut dst_pair, &dst_pair, COUNT_0); + volatile_copy_nonoverlapping_memory(&mut dst_pair, &src_pair, 0); + volatile_copy_memory(&mut dst_empty, &dst_empty, 100); + volatile_copy_nonoverlapping_memory(&mut dst_empty, &src_empty, + COUNT_100); + volatile_set_memory(&mut dst_empty, 0, COUNT_100); + volatile_set_memory(&mut dst_pair, 0, COUNT_0); + volatile_store(&mut dst_empty, ()); + volatile_store(&mut dst_empty, src_empty); + volatile_load(&src_empty); + } +} diff --git a/tests/ui/issues/issue-39848.rs b/tests/ui/issues/issue-39848.rs new file mode 100644 index 000000000..1964d7399 --- /dev/null +++ b/tests/ui/issues/issue-39848.rs @@ -0,0 +1,9 @@ +macro_rules! get_opt { + ($tgt:expr, $field:ident) => { + if $tgt.has_$field() {} //~ ERROR expected `{`, found `foo` + } +} + +fn main() { + get_opt!(bar, foo); +} diff --git a/tests/ui/issues/issue-39848.stderr b/tests/ui/issues/issue-39848.stderr new file mode 100644 index 000000000..387ef0776 --- /dev/null +++ b/tests/ui/issues/issue-39848.stderr @@ -0,0 +1,25 @@ +error: expected `{`, found `foo` + --> $DIR/issue-39848.rs:3:21 + | +LL | if $tgt.has_$field() {} + | ^^^^^^ expected `{` +... +LL | get_opt!(bar, foo); + | ------------------ in this macro invocation + | +note: the `if` expression is missing a block after this condition + --> $DIR/issue-39848.rs:3:12 + | +LL | if $tgt.has_$field() {} + | ^^^^^^^^^ +... +LL | get_opt!(bar, foo); + | ------------------ in this macro invocation + = note: this error originates in the macro `get_opt` (in Nightly builds, run with -Z macro-backtrace for more info) +help: try placing this code inside a block + | +LL | if $tgt.has_{ $field() } {} + | + + + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-3991.rs b/tests/ui/issues/issue-3991.rs new file mode 100644 index 000000000..4851eddf5 --- /dev/null +++ b/tests/ui/issues/issue-3991.rs @@ -0,0 +1,16 @@ +// check-pass +#![allow(dead_code)] + +// pretty-expanded FIXME #23616 + +struct HasNested { + nest: Vec<Vec<isize> > , +} + +impl HasNested { + fn method_push_local(&mut self) { + self.nest[0].push(0); + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-3993.rs b/tests/ui/issues/issue-3993.rs new file mode 100644 index 000000000..9dea54ea7 --- /dev/null +++ b/tests/ui/issues/issue-3993.rs @@ -0,0 +1,10 @@ +use zoo::fly; //~ ERROR: function `fly` is private + +mod zoo { + fn fly() {} +} + + +fn main() { + fly(); +} diff --git a/tests/ui/issues/issue-3993.stderr b/tests/ui/issues/issue-3993.stderr new file mode 100644 index 000000000..deecf7a9d --- /dev/null +++ b/tests/ui/issues/issue-3993.stderr @@ -0,0 +1,15 @@ +error[E0603]: function `fly` is private + --> $DIR/issue-3993.rs:1:10 + | +LL | use zoo::fly; + | ^^^ private function + | +note: the function `fly` is defined here + --> $DIR/issue-3993.rs:4:5 + | +LL | fn fly() {} + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/issues/issue-39970.rs b/tests/ui/issues/issue-39970.rs new file mode 100644 index 000000000..f51e3b522 --- /dev/null +++ b/tests/ui/issues/issue-39970.rs @@ -0,0 +1,21 @@ +trait Array<'a> { + type Element: 'a; +} + +trait Visit { + fn visit() {} +} + +impl<'a> Array<'a> for () { + type Element = &'a (); +} + +impl Visit for () where + //(): for<'a> Array<'a, Element=&'a ()>, // No ICE + (): for<'a> Array<'a, Element=()>, // ICE +{} + +fn main() { + <() as Visit>::visit(); + //~^ ERROR type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()` +} diff --git a/tests/ui/issues/issue-39970.stderr b/tests/ui/issues/issue-39970.stderr new file mode 100644 index 000000000..0cabdf7f2 --- /dev/null +++ b/tests/ui/issues/issue-39970.stderr @@ -0,0 +1,23 @@ +error[E0271]: type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()` + --> $DIR/issue-39970.rs:19:5 + | +LL | <() as Visit>::visit(); + | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()` + | +note: expected this to be `()` + --> $DIR/issue-39970.rs:10:20 + | +LL | type Element = &'a (); + | ^^^^^^ +note: required for `()` to implement `Visit` + --> $DIR/issue-39970.rs:13:6 + | +LL | impl Visit for () where + | ^^^^^ ^^ +LL | //(): for<'a> Array<'a, Element=&'a ()>, // No ICE +LL | (): for<'a> Array<'a, Element=()>, // ICE + | ---------- unsatisfied trait bound introduced here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/issues/issue-39984.rs b/tests/ui/issues/issue-39984.rs new file mode 100644 index 000000000..1c9ae26ca --- /dev/null +++ b/tests/ui/issues/issue-39984.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +#![allow(unreachable_code)] +// Regression test for issue #39984. +// +// The key here is that the error type of the `Ok` call ought to be +// constrained to `String`, even though it is dead-code. + +fn main() {} + +fn t() -> Result<(), String> { + return Err("".into()); + Ok(()) +} diff --git a/tests/ui/issues/issue-40000.rs b/tests/ui/issues/issue-40000.rs new file mode 100644 index 000000000..a6e05e7ba --- /dev/null +++ b/tests/ui/issues/issue-40000.rs @@ -0,0 +1,9 @@ +fn main() { + let bar: fn(&mut u32) = |_| {}; + + fn foo(x: Box<dyn Fn(&i32)>) {} + let bar = Box::new(|x: &i32| {}) as Box<dyn Fn(_)>; + foo(bar); + //~^ ERROR mismatched types + //~| ERROR mismatched types +} diff --git a/tests/ui/issues/issue-40000.stderr b/tests/ui/issues/issue-40000.stderr new file mode 100644 index 000000000..c41fbb9d2 --- /dev/null +++ b/tests/ui/issues/issue-40000.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-40000.rs:6:9 + | +LL | foo(bar); + | ^^^ one type is more general than the other + | + = note: expected trait object `dyn for<'a> Fn(&'a i32)` + found trait object `dyn Fn(&i32)` + +error[E0308]: mismatched types + --> $DIR/issue-40000.rs:6:9 + | +LL | foo(bar); + | ^^^ one type is more general than the other + | + = note: expected trait object `dyn for<'a> Fn(&'a i32)` + found trait object `dyn Fn(&i32)` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-40003.rs b/tests/ui/issues/issue-40003.rs new file mode 100644 index 000000000..5e61361f9 --- /dev/null +++ b/tests/ui/issues/issue-40003.rs @@ -0,0 +1,178 @@ +// run-pass +#![allow(unused_must_use)] +fn main() { + if false { test(); } +} + +fn test() { + let rx = Err::<Vec<usize>, u32>(1).into_future(); + + rx.map(|l: Vec<usize>| stream::iter(l.into_iter().map(|i| Ok(i)))) + .flatten_stream() + .chunks(50) + .buffer_unordered(5); +} + +use future::{Future, IntoFuture}; +mod future { + use std::result; + + use {stream, Stream}; + + pub trait Future { + type Item; + type Error; + + fn map<F, U>(self, _: F) -> Map<Self, F> + where F: FnOnce(Self::Item) -> U, + Self: Sized, + { + panic!() + } + + fn flatten_stream(self) -> FlattenStream<Self> + where <Self as Future>::Item: stream::Stream<Error=Self::Error>, + Self: Sized + { + panic!() + } + } + + pub trait IntoFuture { + type Future: Future<Item=Self::Item, Error=Self::Error>; + type Item; + type Error; + fn into_future(self) -> Self::Future; + } + + impl<F: Future> IntoFuture for F { + type Future = F; + type Item = F::Item; + type Error = F::Error; + + fn into_future(self) -> F { + panic!() + } + } + + impl<T, E> IntoFuture for result::Result<T, E> { + type Future = FutureResult<T, E>; + type Item = T; + type Error = E; + + fn into_future(self) -> FutureResult<T, E> { + panic!() + } + } + + pub struct Map<A, F> { + _a: (A, F), + } + + impl<U, A, F> Future for Map<A, F> + where A: Future, + F: FnOnce(A::Item) -> U, + { + type Item = U; + type Error = A::Error; + } + + pub struct FlattenStream<F> { + _f: F, + } + + impl<F> Stream for FlattenStream<F> + where F: Future, + <F as Future>::Item: Stream<Error=F::Error>, + { + type Item = <F::Item as Stream>::Item; + type Error = <F::Item as Stream>::Error; + } + + pub struct FutureResult<T, E> { + _inner: (T, E), + } + + impl<T, E> Future for FutureResult<T, E> { + type Item = T; + type Error = E; + } +} + +mod stream { + use IntoFuture; + + pub trait Stream { + type Item; + type Error; + + fn buffer_unordered(self, amt: usize) -> BufferUnordered<Self> + where Self::Item: IntoFuture<Error = <Self as Stream>::Error>, + Self: Sized + { + new(self, amt) + } + + fn chunks(self, _capacity: usize) -> Chunks<Self> + where Self: Sized + { + panic!() + } + } + + pub struct IterStream<I> { + _iter: I, + } + + pub fn iter<J, T, E>(_: J) -> IterStream<J::IntoIter> + where J: IntoIterator<Item=Result<T, E>>, + { + panic!() + } + + impl<I, T, E> Stream for IterStream<I> + where I: Iterator<Item=Result<T, E>>, + { + type Item = T; + type Error = E; + } + + pub struct Chunks<S> { + _stream: S + } + + impl<S> Stream for Chunks<S> + where S: Stream + { + type Item = Result<Vec<<S as Stream>::Item>, u32>; + type Error = <S as Stream>::Error; + } + + pub struct BufferUnordered<S> { + _stream: S, + } + + enum Slot<T> { + Next(#[allow(unused_tuple_struct_fields)] usize), + _Data { _a: T }, + } + + fn new<S>(_s: S, _amt: usize) -> BufferUnordered<S> + where S: Stream, + S::Item: IntoFuture<Error=<S as Stream>::Error>, + { + (0..0).map(|_| { + Slot::Next::<<S::Item as IntoFuture>::Future>(1) + }).collect::<Vec<_>>(); + panic!() + } + + impl<S> Stream for BufferUnordered<S> + where S: Stream, + S::Item: IntoFuture<Error=<S as Stream>::Error>, + { + type Item = <S::Item as IntoFuture>::Item; + type Error = <S as Stream>::Error; + } +} +use stream::Stream; diff --git a/tests/ui/issues/issue-40085.rs b/tests/ui/issues/issue-40085.rs new file mode 100644 index 000000000..132044cfd --- /dev/null +++ b/tests/ui/issues/issue-40085.rs @@ -0,0 +1,13 @@ +// run-pass +use std::ops::Index; +fn bar() {} +static UNIT: () = (); +struct S; +impl Index<fn()> for S { + type Output = (); + fn index(&self, _: fn()) -> &() { &UNIT } +} +fn main() { + S.index(bar); + S[bar]; +} diff --git a/tests/ui/issues/issue-40136.rs b/tests/ui/issues/issue-40136.rs new file mode 100644 index 000000000..29d3fc2d5 --- /dev/null +++ b/tests/ui/issues/issue-40136.rs @@ -0,0 +1,15 @@ +// check-pass +#![allow(dead_code)] + +macro_rules! m { () => { 0 } } + +trait T { + const C: i32 = m!(); +} + +struct S; +impl S { + const C: i32 = m!(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-40235.rs b/tests/ui/issues/issue-40235.rs new file mode 100644 index 000000000..0f799c350 --- /dev/null +++ b/tests/ui/issues/issue-40235.rs @@ -0,0 +1,8 @@ +// run-pass +#![allow(unused_variables)] +fn foo() {} + +fn main() { + while let Some(foo) = Some(1) { break } + foo(); +} diff --git a/tests/ui/issues/issue-4025.rs b/tests/ui/issues/issue-4025.rs new file mode 100644 index 000000000..dc534c64c --- /dev/null +++ b/tests/ui/issues/issue-4025.rs @@ -0,0 +1,25 @@ +// check-pass +#![allow(dead_code)] +#![allow(unused_mut)] +/* +# if b { x } else { y } requires identical types for x and y +*/ + +fn print1(b: bool, s1: &str, s2: &str) { + println!("{}", if b { s1 } else { s2 }); +} +fn print2<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { + println!("{}", if b { s1 } else { s2 }); +} +fn print3(b: bool, s1: &str, s2: &str) { + let mut s: &str; + if b { s = s1; } else { s = s2; } + println!("{}", s); +} +fn print4<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { + let mut s: &str; + if b { s = s1; } else { s = s2; } + println!("{}", s); +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-40288-2.rs b/tests/ui/issues/issue-40288-2.rs new file mode 100644 index 000000000..032a2e65f --- /dev/null +++ b/tests/ui/issues/issue-40288-2.rs @@ -0,0 +1,31 @@ +fn prove_static<T: 'static + ?Sized>(_: &'static T) {} + +fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { + let mut out = [x]; + { + let slice: &mut [_] = &mut out; + slice[0] = y; + } + out[0] + //~^ ERROR explicit lifetime required in the type of `y` [E0621] +} + +struct Struct<T, U: ?Sized> { + head: T, + _tail: U +} + +fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { + let mut out = Struct { head: x, _tail: [()] }; + { + let dst: &mut Struct<_, [()]> = &mut out; + dst.head = y; + } + out.head + //~^ ERROR explicit lifetime required in the type of `y` [E0621] +} + +fn main() { + prove_static(lifetime_transmute_slice("", &String::from("foo"))); + prove_static(lifetime_transmute_struct("", &String::from("bar"))); +} diff --git a/tests/ui/issues/issue-40288-2.stderr b/tests/ui/issues/issue-40288-2.stderr new file mode 100644 index 000000000..2c64856b0 --- /dev/null +++ b/tests/ui/issues/issue-40288-2.stderr @@ -0,0 +1,21 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $DIR/issue-40288-2.rs:9:5 + | +LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` +... +LL | out[0] + | ^^^^^^ lifetime `'a` required + +error[E0621]: explicit lifetime required in the type of `y` + --> $DIR/issue-40288-2.rs:24:5 + | +LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` +... +LL | out.head + | ^^^^^^^^ lifetime `'a` required + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/issues/issue-40288.rs b/tests/ui/issues/issue-40288.rs new file mode 100644 index 000000000..60204c117 --- /dev/null +++ b/tests/ui/issues/issue-40288.rs @@ -0,0 +1,20 @@ +fn save_ref<'a>(refr: &'a i32, to: &mut [&'a i32]) { + for val in &mut *to { + *val = refr; + } +} + +fn main() { + let ref init = 0i32; + let ref mut refr = 1i32; + + let mut out = [init]; + + save_ref(&*refr, &mut out); + + // This shouldn't be allowed as `refr` is borrowed + *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed + + // Prints 3?! + println!("{:?}", out[0]); +} diff --git a/tests/ui/issues/issue-40288.stderr b/tests/ui/issues/issue-40288.stderr new file mode 100644 index 000000000..fb4ecab36 --- /dev/null +++ b/tests/ui/issues/issue-40288.stderr @@ -0,0 +1,15 @@ +error[E0506]: cannot assign to `*refr` because it is borrowed + --> $DIR/issue-40288.rs:16:5 + | +LL | save_ref(&*refr, &mut out); + | ------ borrow of `*refr` occurs here +... +LL | *refr = 3; + | ^^^^^^^^^ assignment to borrowed `*refr` occurs here +... +LL | println!("{:?}", out[0]); + | ------ borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/issues/issue-40350.rs b/tests/ui/issues/issue-40350.rs new file mode 100644 index 000000000..a39a8519a --- /dev/null +++ b/tests/ui/issues/issue-40350.rs @@ -0,0 +1,10 @@ +// check-pass + +enum E { + A = { + enum F { B } + 0 + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs b/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs new file mode 100644 index 000000000..254956ae3 --- /dev/null +++ b/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs @@ -0,0 +1,10 @@ +// Check that we do not suggest `ref f` here in the `main()` function. +struct Foo { + pub v: Vec<String>, +} + +fn main() { + let mut f = Foo { v: Vec::new() }; + f.v.push("hello".to_string()); + let e = f.v[0]; //~ ERROR cannot move out of index +} diff --git a/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr b/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr new file mode 100644 index 000000000..e15eed656 --- /dev/null +++ b/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr @@ -0,0 +1,14 @@ +error[E0507]: cannot move out of index of `Vec<String>` + --> $DIR/issue-40402-1.rs:9:13 + | +LL | let e = f.v[0]; + | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let e = &f.v[0]; + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/issues/issue-40402-ref-hints/issue-40402-2.rs b/tests/ui/issues/issue-40402-ref-hints/issue-40402-2.rs new file mode 100644 index 000000000..1fb6e31e9 --- /dev/null +++ b/tests/ui/issues/issue-40402-ref-hints/issue-40402-2.rs @@ -0,0 +1,6 @@ +// Check that we do suggest `(ref a, ref b)` here, since `a` and `b` +// are nested within a pattern +fn main() { + let x = vec![(String::new(), String::new())]; + let (a, b) = x[0]; //~ ERROR cannot move out of index +} diff --git a/tests/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr b/tests/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr new file mode 100644 index 000000000..1bc554efb --- /dev/null +++ b/tests/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr @@ -0,0 +1,18 @@ +error[E0507]: cannot move out of index of `Vec<(String, String)>` + --> $DIR/issue-40402-2.rs:5:18 + | +LL | let (a, b) = x[0]; + | - - ^^^^ + | | | + | | ...and here + | data moved here + | + = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing here + | +LL | let (a, b) = &x[0]; + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/issues/issue-40408.rs b/tests/ui/issues/issue-40408.rs new file mode 100644 index 000000000..81acc41cb --- /dev/null +++ b/tests/ui/issues/issue-40408.rs @@ -0,0 +1,7 @@ +// run-pass +fn main() { + println!("{}", 0E+10); + println!("{}", 0e+10); + println!("{}", 00e+10); + println!("{}", 00E+10); +} diff --git a/tests/ui/issues/issue-40510-1.migrate.stderr b/tests/ui/issues/issue-40510-1.migrate.stderr new file mode 100644 index 000000000..776a724d3 --- /dev/null +++ b/tests/ui/issues/issue-40510-1.migrate.stderr @@ -0,0 +1,13 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-1.rs:11:9 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | &mut x + | ^^^^^^ returns a reference to a captured variable which escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-40510-1.rs b/tests/ui/issues/issue-40510-1.rs new file mode 100644 index 000000000..ca53dcd9b --- /dev/null +++ b/tests/ui/issues/issue-40510-1.rs @@ -0,0 +1,12 @@ +#![allow(unused)] + +fn f() { + let mut x: Box<()> = Box::new(()); + + || { + &mut x + }; + //~^^ ERROR captured variable cannot escape `FnMut` closure body +} + +fn main() {} diff --git a/tests/ui/issues/issue-40510-1.stderr b/tests/ui/issues/issue-40510-1.stderr new file mode 100644 index 000000000..e88f31ea1 --- /dev/null +++ b/tests/ui/issues/issue-40510-1.stderr @@ -0,0 +1,19 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-1.rs:7:9 + | +LL | let mut x: Box<()> = Box::new(()); + | ----- variable defined here +LL | +LL | || { + | - inferred to be a `FnMut` closure +LL | &mut x + | ^^^^^- + | | | + | | variable captured here + | returns a reference to a captured variable which escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-40510-2.rs b/tests/ui/issues/issue-40510-2.rs new file mode 100644 index 000000000..3ae84be05 --- /dev/null +++ b/tests/ui/issues/issue-40510-2.rs @@ -0,0 +1,13 @@ +// check-pass +#![allow(unused)] + +fn f() { + let x: Box<()> = Box::new(()); + + || { + &x + }; +} + + +fn main() {} diff --git a/tests/ui/issues/issue-40510-3.migrate.stderr b/tests/ui/issues/issue-40510-3.migrate.stderr new file mode 100644 index 000000000..a49475a85 --- /dev/null +++ b/tests/ui/issues/issue-40510-3.migrate.stderr @@ -0,0 +1,15 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-3.rs:11:9 + | +LL | || { + | - inferred to be a `FnMut` closure +LL | / || { +LL | | x.push(()) +LL | | } + | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-40510-3.rs b/tests/ui/issues/issue-40510-3.rs new file mode 100644 index 000000000..181263adc --- /dev/null +++ b/tests/ui/issues/issue-40510-3.rs @@ -0,0 +1,14 @@ +#![allow(unused)] + +fn f() { + let mut x: Vec<()> = Vec::new(); + + || { + || { + x.push(()) + } + //~^^^ ERROR captured variable cannot escape `FnMut` closure body + }; +} + +fn main() {} diff --git a/tests/ui/issues/issue-40510-3.stderr b/tests/ui/issues/issue-40510-3.stderr new file mode 100644 index 000000000..eb077415e --- /dev/null +++ b/tests/ui/issues/issue-40510-3.stderr @@ -0,0 +1,23 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-40510-3.rs:7:9 + | +LL | let mut x: Vec<()> = Vec::new(); + | ----- variable defined here +LL | +LL | || { + | - inferred to be a `FnMut` closure +LL | / || { +LL | | x.push(()) + | | - variable captured here +LL | | } + | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape +help: consider adding 'move' keyword before the nested closure + | +LL | move || { + | ++++ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-40510-4.rs b/tests/ui/issues/issue-40510-4.rs new file mode 100644 index 000000000..48bb8d36f --- /dev/null +++ b/tests/ui/issues/issue-40510-4.rs @@ -0,0 +1,15 @@ +// check-pass +#![allow(unused)] + +fn f() { + let x: Vec<()> = Vec::new(); + + || { + || { + x.len() + } + }; +} + + +fn main() {} diff --git a/tests/ui/issues/issue-40610.rs b/tests/ui/issues/issue-40610.rs new file mode 100644 index 000000000..c01233605 --- /dev/null +++ b/tests/ui/issues/issue-40610.rs @@ -0,0 +1,6 @@ +fn f(_: &[f32]) {} + +fn main() { + () + f(&[1.0]); + //~^ ERROR cannot add `()` to `()` +} diff --git a/tests/ui/issues/issue-40610.stderr b/tests/ui/issues/issue-40610.stderr new file mode 100644 index 000000000..b4e302dff --- /dev/null +++ b/tests/ui/issues/issue-40610.stderr @@ -0,0 +1,11 @@ +error[E0369]: cannot add `()` to `()` + --> $DIR/issue-40610.rs:4:8 + | +LL | () + f(&[1.0]); + | -- ^ --------- () + | | + | () + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-40749.rs b/tests/ui/issues/issue-40749.rs new file mode 100644 index 000000000..0a847853b --- /dev/null +++ b/tests/ui/issues/issue-40749.rs @@ -0,0 +1,6 @@ +fn main() { + [0; ..10]; + //~^ ERROR mismatched types + //~| expected type `usize` + //~| found struct `RangeTo<{integer}>` +} diff --git a/tests/ui/issues/issue-40749.stderr b/tests/ui/issues/issue-40749.stderr new file mode 100644 index 000000000..fa239f744 --- /dev/null +++ b/tests/ui/issues/issue-40749.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-40749.rs:2:9 + | +LL | [0; ..10]; + | ^^^^ expected `usize`, found struct `RangeTo` + | + = note: expected type `usize` + found struct `RangeTo<{integer}>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-40782.fixed b/tests/ui/issues/issue-40782.fixed new file mode 100644 index 000000000..305a9c329 --- /dev/null +++ b/tests/ui/issues/issue-40782.fixed @@ -0,0 +1,8 @@ +// run-rustfix + +fn main() { + for _i in 0..2 { //~ ERROR missing `in` + } + for _i in 0..2 { //~ ERROR missing `in` + } +} diff --git a/tests/ui/issues/issue-40782.rs b/tests/ui/issues/issue-40782.rs new file mode 100644 index 000000000..43460ec15 --- /dev/null +++ b/tests/ui/issues/issue-40782.rs @@ -0,0 +1,8 @@ +// run-rustfix + +fn main() { + for _i 0..2 { //~ ERROR missing `in` + } + for _i of 0..2 { //~ ERROR missing `in` + } +} diff --git a/tests/ui/issues/issue-40782.stderr b/tests/ui/issues/issue-40782.stderr new file mode 100644 index 000000000..81f419bf6 --- /dev/null +++ b/tests/ui/issues/issue-40782.stderr @@ -0,0 +1,14 @@ +error: missing `in` in `for` loop + --> $DIR/issue-40782.rs:4:11 + | +LL | for _i 0..2 { + | ^ help: try adding `in` here + +error: missing `in` in `for` loop + --> $DIR/issue-40782.rs:6:12 + | +LL | for _i of 0..2 { + | ^^ help: try using `in` here instead + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-40827.rs b/tests/ui/issues/issue-40827.rs new file mode 100644 index 000000000..6e42c5061 --- /dev/null +++ b/tests/ui/issues/issue-40827.rs @@ -0,0 +1,17 @@ +use std::rc::Rc; +use std::sync::Arc; + +struct Foo(Arc<Bar>); + +enum Bar { + A(Rc<Foo>), + B(Option<Foo>), +} + +fn f<T: Send>(_: T) {} + +fn main() { + f(Foo(Arc::new(Bar::B(None)))); + //~^ ERROR E0277 + //~| ERROR E0277 +} diff --git a/tests/ui/issues/issue-40827.stderr b/tests/ui/issues/issue-40827.stderr new file mode 100644 index 000000000..7f5c578ae --- /dev/null +++ b/tests/ui/issues/issue-40827.stderr @@ -0,0 +1,55 @@ +error[E0277]: `Rc<Foo>` cannot be shared between threads safely + --> $DIR/issue-40827.rs:14:7 + | +LL | f(Foo(Arc::new(Bar::B(None)))); + | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: within `Bar`, the trait `Sync` is not implemented for `Rc<Foo>` +note: required because it appears within the type `Bar` + --> $DIR/issue-40827.rs:6:6 + | +LL | enum Bar { + | ^^^ + = note: required for `Arc<Bar>` to implement `Send` +note: required because it appears within the type `Foo` + --> $DIR/issue-40827.rs:4:8 + | +LL | struct Foo(Arc<Bar>); + | ^^^ +note: required by a bound in `f` + --> $DIR/issue-40827.rs:11:9 + | +LL | fn f<T: Send>(_: T) {} + | ^^^^ required by this bound in `f` + +error[E0277]: `Rc<Foo>` cannot be sent between threads safely + --> $DIR/issue-40827.rs:14:7 + | +LL | f(Foo(Arc::new(Bar::B(None)))); + | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: within `Bar`, the trait `Send` is not implemented for `Rc<Foo>` +note: required because it appears within the type `Bar` + --> $DIR/issue-40827.rs:6:6 + | +LL | enum Bar { + | ^^^ + = note: required for `Arc<Bar>` to implement `Send` +note: required because it appears within the type `Foo` + --> $DIR/issue-40827.rs:4:8 + | +LL | struct Foo(Arc<Bar>); + | ^^^ +note: required by a bound in `f` + --> $DIR/issue-40827.rs:11:9 + | +LL | fn f<T: Send>(_: T) {} + | ^^^^ required by this bound in `f` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-40845.rs b/tests/ui/issues/issue-40845.rs new file mode 100644 index 000000000..a4ede6adf --- /dev/null +++ b/tests/ui/issues/issue-40845.rs @@ -0,0 +1,6 @@ +trait T { m!(); } //~ ERROR cannot find macro `m` in this scope + +struct S; +impl S { m!(); } //~ ERROR cannot find macro `m` in this scope + +fn main() {} diff --git a/tests/ui/issues/issue-40845.stderr b/tests/ui/issues/issue-40845.stderr new file mode 100644 index 000000000..66bf05320 --- /dev/null +++ b/tests/ui/issues/issue-40845.stderr @@ -0,0 +1,14 @@ +error: cannot find macro `m` in this scope + --> $DIR/issue-40845.rs:1:11 + | +LL | trait T { m!(); } + | ^ + +error: cannot find macro `m` in this scope + --> $DIR/issue-40845.rs:4:10 + | +LL | impl S { m!(); } + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-40861.rs b/tests/ui/issues/issue-40861.rs new file mode 100644 index 000000000..d8a8384a5 --- /dev/null +++ b/tests/ui/issues/issue-40861.rs @@ -0,0 +1,6 @@ +fn f(_: &[f32]) {} + +fn main() { + ()[f(&[1.0])]; + //~^ ERROR cannot index into a value of type `()` +} diff --git a/tests/ui/issues/issue-40861.stderr b/tests/ui/issues/issue-40861.stderr new file mode 100644 index 000000000..84e38b9bb --- /dev/null +++ b/tests/ui/issues/issue-40861.stderr @@ -0,0 +1,11 @@ +error[E0608]: cannot index into a value of type `()` + --> $DIR/issue-40861.rs:4:5 + | +LL | ()[f(&[1.0])]; + | ^^^^^^^^^^^^^ + | + = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0608`. diff --git a/tests/ui/issues/issue-40883.rs b/tests/ui/issues/issue-40883.rs new file mode 100644 index 000000000..8a4aef46d --- /dev/null +++ b/tests/ui/issues/issue-40883.rs @@ -0,0 +1,94 @@ +// run-pass +#![allow(dead_code)] +// check that we don't have linear stack usage with multiple calls to `push` + +#![feature(test)] + +extern crate test; +use std::mem; + +fn meal() -> Big { + if test::black_box(false) { + panic!() + } + Big { drop_me: [ + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + ]} +} + +pub struct Big { + drop_me: [Option<Box<u8>>; 48], +} + +#[inline] +fn push(out: &mut Vec<Big>) { + out.push(meal()); +} + +#[inline(never)] +pub fn supersize_me(out: &mut Vec<Big>) { + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); // 16 calls to `push` + + verify_stack_usage(out); + + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); // 16 calls to `push` +} + +#[inline(never)] +fn verify_stack_usage(before_ptr: *mut Vec<Big>) { + // To check stack usage, create locals before and after + // and check the difference in addresses between them. + let mut stack_var: Vec<Big> = vec![]; + test::black_box(&mut stack_var); + let stack_usage = isize::abs( + (&mut stack_var as *mut _ as isize) - + (before_ptr as isize)) as usize; + // Give space for 2 copies of `Big` + 272 "misc" bytes + // (value observed on x86_64-pc-windows-gnu). + if stack_usage > mem::size_of::<Big>() * 2 + 272 { + panic!("used {} bytes of stack, but `struct Big` is only {} bytes", + stack_usage, mem::size_of::<Big>()); + } + +} + +pub fn main() { + let mut v = vec![]; + test::black_box(&mut v); + supersize_me(&mut v); +} diff --git a/tests/ui/issues/issue-40951.rs b/tests/ui/issues/issue-40951.rs new file mode 100644 index 000000000..49171eba6 --- /dev/null +++ b/tests/ui/issues/issue-40951.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(unused_variables)] +// Regression test for #40951. + +const FOO: [&'static str; 1] = ["foo"]; + +fn find<T: PartialEq>(t: &[T], element: &T) { } + +fn main() { + let x = format!("hi"); + find(&FOO, &&*x); +} diff --git a/tests/ui/issues/issue-41053.rs b/tests/ui/issues/issue-41053.rs new file mode 100644 index 000000000..967edfd44 --- /dev/null +++ b/tests/ui/issues/issue-41053.rs @@ -0,0 +1,21 @@ +// run-pass +// aux-build:issue-41053.rs + +pub trait Trait { fn foo(&self) {} } + +pub struct Foo; + +impl Iterator for Foo { + type Item = Box<dyn Trait>; + fn next(&mut self) -> Option<Box<dyn Trait>> { + extern crate issue_41053; + impl ::Trait for issue_41053::Test { + fn foo(&self) {} + } + Some(Box::new(issue_41053::Test)) + } +} + +fn main() { + Foo.next().unwrap().foo(); +} diff --git a/tests/ui/issues/issue-41139.rs b/tests/ui/issues/issue-41139.rs new file mode 100644 index 000000000..94c53216f --- /dev/null +++ b/tests/ui/issues/issue-41139.rs @@ -0,0 +1,12 @@ +trait Trait {} + +fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { + panic!("") +} + +fn main() { + // This isn't great. The issue here is that `dyn Trait` is not sized, so + // `dyn Fn() -> dyn Trait` is not well-formed. + let t: &dyn Trait = &get_function()(); + //~^ ERROR expected function, found `&dyn Fn() -> (dyn Trait + 'static)` +} diff --git a/tests/ui/issues/issue-41139.stderr b/tests/ui/issues/issue-41139.stderr new file mode 100644 index 000000000..97492e6e0 --- /dev/null +++ b/tests/ui/issues/issue-41139.stderr @@ -0,0 +1,12 @@ +error[E0618]: expected function, found `&dyn Fn() -> (dyn Trait + 'static)` + --> $DIR/issue-41139.rs:10:26 + | +LL | fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { + | -------------------------------------------------- `get_function` defined here returns `&dyn Fn() -> (dyn Trait + 'static)` +... +LL | let t: &dyn Trait = &get_function()(); + | ^^^^^^^^^^^^^^ this trait object returns an unsized value `(dyn Trait + 'static)`, so it cannot be called + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-41213.rs b/tests/ui/issues/issue-41213.rs new file mode 100644 index 000000000..5c91bf711 --- /dev/null +++ b/tests/ui/issues/issue-41213.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(dead_code)] +enum A { + A1, + A2, + A3, +} + +enum B { + B1(String, String), + B2(String, String), +} + +fn main() { + let a = A::A1; + loop { + let _ctor = match a { + A::A3 => break, + A::A1 => B::B1, + A::A2 => B::B2, + }; + break; + } +} diff --git a/tests/ui/issues/issue-41229-ref-str.rs b/tests/ui/issues/issue-41229-ref-str.rs new file mode 100644 index 000000000..fe5e6cd6e --- /dev/null +++ b/tests/ui/issues/issue-41229-ref-str.rs @@ -0,0 +1,4 @@ +pub fn example(ref s: str) {} +//~^ ERROR the size for values of type + +fn main() {} diff --git a/tests/ui/issues/issue-41229-ref-str.stderr b/tests/ui/issues/issue-41229-ref-str.stderr new file mode 100644 index 000000000..31fdf3b72 --- /dev/null +++ b/tests/ui/issues/issue-41229-ref-str.stderr @@ -0,0 +1,16 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/issue-41229-ref-str.rs:1:16 + | +LL | pub fn example(ref s: str) {} + | ^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = help: unsized fn params are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | pub fn example(ref s: &str) {} + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-41272.rs b/tests/ui/issues/issue-41272.rs new file mode 100644 index 000000000..1f4da46f8 --- /dev/null +++ b/tests/ui/issues/issue-41272.rs @@ -0,0 +1,21 @@ +// check-pass +#![allow(dead_code)] +struct Foo; + +impl Foo { + fn bar(&mut self) -> bool { true } +} + +fn error(foo: &mut Foo) { + if let Some(_) = Some(true) { + } else if foo.bar() {} +} + +fn ok(foo: &mut Foo) { + if let Some(_) = Some(true) { + } else { + if foo.bar() {} + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-41298.rs b/tests/ui/issues/issue-41298.rs new file mode 100644 index 000000000..a1b4de39b --- /dev/null +++ b/tests/ui/issues/issue-41298.rs @@ -0,0 +1,8 @@ +// check-pass +#![allow(dead_code)] +struct Function<T, F> { t: T, f: F } + +impl<T, R> Function<T, fn() -> R> { fn foo() { } } +impl<T, R> Function<T, fn() -> R> { fn bar() { } } + +fn main() { } diff --git a/tests/ui/issues/issue-41394-rpass.rs b/tests/ui/issues/issue-41394-rpass.rs new file mode 100644 index 000000000..37c652523 --- /dev/null +++ b/tests/ui/issues/issue-41394-rpass.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-41394.rs + +extern crate issue_41394 as lib; + +fn main() { + assert_eq!(lib::foo() as u32, 42); +} diff --git a/tests/ui/issues/issue-41394.rs b/tests/ui/issues/issue-41394.rs new file mode 100644 index 000000000..07cad8796 --- /dev/null +++ b/tests/ui/issues/issue-41394.rs @@ -0,0 +1,11 @@ +enum Foo { + A = "" + 1 + //~^ ERROR cannot add `{integer}` to `&str` +} + +enum Bar { + A = Foo::A as isize + //~^ const +} + +fn main() {} diff --git a/tests/ui/issues/issue-41394.stderr b/tests/ui/issues/issue-41394.stderr new file mode 100644 index 000000000..1b5c64628 --- /dev/null +++ b/tests/ui/issues/issue-41394.stderr @@ -0,0 +1,17 @@ +error[E0369]: cannot add `{integer}` to `&str` + --> $DIR/issue-41394.rs:2:12 + | +LL | A = "" + 1 + | -- ^ - {integer} + | | + | &str + +note: erroneous constant used + --> $DIR/issue-41394.rs:7:9 + | +LL | A = Foo::A as isize + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-41479.rs b/tests/ui/issues/issue-41479.rs new file mode 100644 index 000000000..6daaf440e --- /dev/null +++ b/tests/ui/issues/issue-41479.rs @@ -0,0 +1,9 @@ +// run-pass +fn split<A, B>(pair: (A, B)) { + let _a = pair.0; + let _b = pair.1; +} + +fn main() { + split(((), ((), ()))); +} diff --git a/tests/ui/issues/issue-41498.rs b/tests/ui/issues/issue-41498.rs new file mode 100644 index 000000000..ad918ecdd --- /dev/null +++ b/tests/ui/issues/issue-41498.rs @@ -0,0 +1,17 @@ +// run-pass +// regression test for issue #41498. + +struct S; +impl S { + fn mutate(&mut self) {} +} + +fn call_and_ref<T, F: FnOnce() -> T>(x: &mut Option<T>, f: F) -> &mut T { + *x = Some(f()); + x.as_mut().unwrap() +} + +fn main() { + let mut n = None; + call_and_ref(&mut n, || [S])[0].mutate(); +} diff --git a/tests/ui/issues/issue-41549.rs b/tests/ui/issues/issue-41549.rs new file mode 100644 index 000000000..d19926a54 --- /dev/null +++ b/tests/ui/issues/issue-41549.rs @@ -0,0 +1,12 @@ +// aux-build:issue-41549.rs + + +extern crate issue_41549; + +struct S; + +impl issue_41549::Trait for S { + const CONST: () = (); //~ ERROR incompatible type for trait +} + +fn main() {} diff --git a/tests/ui/issues/issue-41549.stderr b/tests/ui/issues/issue-41549.stderr new file mode 100644 index 000000000..62307d387 --- /dev/null +++ b/tests/ui/issues/issue-41549.stderr @@ -0,0 +1,9 @@ +error[E0326]: implemented const `CONST` has an incompatible type for trait + --> $DIR/issue-41549.rs:9:18 + | +LL | const CONST: () = (); + | ^^ expected `u32`, found `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0326`. diff --git a/tests/ui/issues/issue-41604.rs b/tests/ui/issues/issue-41604.rs new file mode 100644 index 000000000..11a1cc25b --- /dev/null +++ b/tests/ui/issues/issue-41604.rs @@ -0,0 +1,11 @@ +// run-pass +struct B; + +impl B { + fn init(&mut self) {} +} + +fn main() { + let mut b = [B]; + b[1-1].init(); +} diff --git a/tests/ui/issues/issue-41628.rs b/tests/ui/issues/issue-41628.rs new file mode 100644 index 000000000..92159824e --- /dev/null +++ b/tests/ui/issues/issue-41628.rs @@ -0,0 +1,7 @@ +// check-pass +#![deny(dead_code)] + +#[used] +static FOO: u32 = 0; + +fn main() {} diff --git a/tests/ui/issues/issue-41652/auxiliary/issue-41652-b.rs b/tests/ui/issues/issue-41652/auxiliary/issue-41652-b.rs new file mode 100644 index 000000000..2ce21b036 --- /dev/null +++ b/tests/ui/issues/issue-41652/auxiliary/issue-41652-b.rs @@ -0,0 +1,6 @@ +pub trait Tr { + // Note: The function needs to be declared over multiple lines to reproduce + // the crash. DO NOT reformat. + fn f() + where Self: Sized; +} diff --git a/tests/ui/issues/issue-41652/issue-41652.rs b/tests/ui/issues/issue-41652/issue-41652.rs new file mode 100644 index 000000000..d8a6f4c8d --- /dev/null +++ b/tests/ui/issues/issue-41652/issue-41652.rs @@ -0,0 +1,14 @@ +// aux-build:issue-41652-b.rs + +extern crate issue_41652_b; + +struct S; + +impl issue_41652_b::Tr for S { + fn f() { + 3.f() + //~^ ERROR can't call method `f` on ambiguous numeric type `{integer}` + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr new file mode 100644 index 000000000..1618f0f5a --- /dev/null +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -0,0 +1,14 @@ +error[E0689]: can't call method `f` on ambiguous numeric type `{integer}` + --> $DIR/issue-41652.rs:9:11 + | +LL | 3.f() + | ^ + | +help: you must specify a concrete type for this numeric value, like `i32` + | +LL | 3_i32.f() + | ~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0689`. diff --git a/tests/ui/issues/issue-41677.rs b/tests/ui/issues/issue-41677.rs new file mode 100644 index 000000000..afddbc799 --- /dev/null +++ b/tests/ui/issues/issue-41677.rs @@ -0,0 +1,28 @@ +// run-pass +// Regression test for #41677. The local variable was winding up with +// a type `Receiver<?T, H>` where `?T` was unconstrained, because we +// failed to enforce the WF obligations and `?T` is a bivariant type +// parameter position. + +#![allow(unused_variables, dead_code)] + +use std::marker::PhantomData; + +trait Handle { + type Inner; +} + +struct ResizingHandle<H>(PhantomData<H>); +impl<H> Handle for ResizingHandle<H> { + type Inner = H; +} + +struct Receiver<T, H: Handle<Inner=T>>(PhantomData<H>); + +fn channel<T>(size: usize) -> Receiver<T, ResizingHandle<T>> { + let rx = Receiver(PhantomData); + rx +} + +fn main() { +} diff --git a/tests/ui/issues/issue-41696.rs b/tests/ui/issues/issue-41696.rs new file mode 100644 index 000000000..d094f7194 --- /dev/null +++ b/tests/ui/issues/issue-41696.rs @@ -0,0 +1,54 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![recursion_limit = "128"] +// this used to cause exponential code-size blowup during LLVM passes. + +#![feature(test)] + +extern crate test; + +struct MayUnwind; + +impl Drop for MayUnwind { + fn drop(&mut self) { + if test::black_box(false) { + panic!() + } + } +} + +struct DS<U> { + may_unwind: MayUnwind, + name: String, + next: U, +} + +fn add<U>(ds: DS<U>, name: String) -> DS<DS<U>> { + DS { + may_unwind: MayUnwind, + name: "?".to_owned(), + next: ds, + } +} + +fn main() { + let deserializers = DS { may_unwind: MayUnwind, name: "?".to_owned(), next: () }; + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); // 0.7s + let deserializers = add(deserializers, "?".to_owned()); // 1.3s + let deserializers = add(deserializers, "?".to_owned()); // 2.4s + let deserializers = add(deserializers, "?".to_owned()); // 6.7s + let deserializers = add(deserializers, "?".to_owned()); // 26.0s + let deserializers = add(deserializers, "?".to_owned()); // 114.0s + let deserializers = add(deserializers, "?".to_owned()); // 228.0s + let deserializers = add(deserializers, "?".to_owned()); // 400.0s + let deserializers = add(deserializers, "?".to_owned()); // 800.0s + let deserializers = add(deserializers, "?".to_owned()); // 1600.0s + let deserializers = add(deserializers, "?".to_owned()); // 3200.0s +} diff --git a/tests/ui/issues/issue-41726.rs b/tests/ui/issues/issue-41726.rs new file mode 100644 index 000000000..39631912c --- /dev/null +++ b/tests/ui/issues/issue-41726.rs @@ -0,0 +1,7 @@ +use std::collections::HashMap; +fn main() { + let things: HashMap<String, Vec<String>> = HashMap::new(); + for src in things.keys() { + things[src.as_str()].sort(); //~ ERROR cannot borrow data in an index of + } +} diff --git a/tests/ui/issues/issue-41726.stderr b/tests/ui/issues/issue-41726.stderr new file mode 100644 index 000000000..b05c1fb14 --- /dev/null +++ b/tests/ui/issues/issue-41726.stderr @@ -0,0 +1,15 @@ +error[E0596]: cannot borrow data in an index of `HashMap<String, Vec<String>>` as mutable + --> $DIR/issue-41726.rs:5:9 + | +LL | things[src.as_str()].sort(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | + = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<String, Vec<String>>` +help: to modify a `HashMap<String, Vec<String>>` use `.get_mut()` + | +LL | things.get_mut(src.as_str()).map(|val| val.sort()); + | ~~~~~~~~~ ~~~~~~~~~~~~~~~ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/issues/issue-41742.rs b/tests/ui/issues/issue-41742.rs new file mode 100644 index 000000000..afe311b4d --- /dev/null +++ b/tests/ui/issues/issue-41742.rs @@ -0,0 +1,25 @@ +use std::ops::{Index, IndexMut}; + +struct S; +struct H; + +impl S { + fn f(&mut self) {} +} + +impl Index<u32> for H { + type Output = S; + fn index(&self, index: u32) -> &S { + unimplemented!() + } +} + +impl IndexMut<u32> for H { + fn index_mut(&mut self, index: u32) -> &mut S { + unimplemented!() + } +} + +fn main() { + H["?"].f(); //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-41742.stderr b/tests/ui/issues/issue-41742.stderr new file mode 100644 index 000000000..61a0ae5fa --- /dev/null +++ b/tests/ui/issues/issue-41742.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/issue-41742.rs:24:7 + | +LL | H["?"].f(); + | ^^^ expected `u32`, found `&str` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-41744.rs b/tests/ui/issues/issue-41744.rs new file mode 100644 index 000000000..dcdd1c21e --- /dev/null +++ b/tests/ui/issues/issue-41744.rs @@ -0,0 +1,7 @@ +// run-pass +trait Tc {} +impl Tc for bool {} + +fn main() { + let _: &[&dyn Tc] = &[&true]; +} diff --git a/tests/ui/issues/issue-41849-variance-req.rs b/tests/ui/issues/issue-41849-variance-req.rs new file mode 100644 index 000000000..af081083a --- /dev/null +++ b/tests/ui/issues/issue-41849-variance-req.rs @@ -0,0 +1,35 @@ +// run-pass +#![allow(dead_code)] +// Regression test for #41849. + +use std::ops::Mul; + +const C: usize = 1; +const CAPACITY: usize = 1 * C; + +struct A<X> { + f: [X; CAPACITY], +} + +struct B<T> { + f: T, +} + +impl<T> Mul for B<T> { + type Output = Self; + fn mul(self, _rhs: B<T>) -> Self::Output { + self + } +} + +impl<T> Mul<usize> for B<T> { + type Output = Self; + fn mul(self, _rhs: usize) -> Self::Output { + self + } +} + +fn main() { + let a = A { f: [1] }; + let _ = B { f: a }; +} diff --git a/tests/ui/issues/issue-41880.rs b/tests/ui/issues/issue-41880.rs new file mode 100644 index 000000000..977c43b71 --- /dev/null +++ b/tests/ui/issues/issue-41880.rs @@ -0,0 +1,29 @@ +fn iterate<T, F>(initial: T, f: F) -> Iterate<T, F> { + Iterate { + state: initial, + f: f, + } +} + +pub struct Iterate<T, F> { + state: T, + f: F +} + +impl<T: Clone, F> Iterator for Iterate<T, F> where F: Fn(&T) -> T { + type Item = T; + + #[inline] + fn next(&mut self) -> Option<Self::Item> { + self.state = (self.f)(&self.state); + Some(self.state.clone()) + } + #[inline] + fn size_hint(&self) -> (usize, Option<usize>) { (usize::MAX, None) } +} + +fn main() { + let a = iterate(0, |x| x+1); + println!("{:?}", a.iter().take(10).collect::<Vec<usize>>()); + //~^ ERROR no method named `iter` found +} diff --git a/tests/ui/issues/issue-41880.stderr b/tests/ui/issues/issue-41880.stderr new file mode 100644 index 000000000..00c375f8d --- /dev/null +++ b/tests/ui/issues/issue-41880.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `iter` found for struct `Iterate` in the current scope + --> $DIR/issue-41880.rs:27:24 + | +LL | pub struct Iterate<T, F> { + | ------------------------ method `iter` not found for this struct +... +LL | println!("{:?}", a.iter().take(10).collect::<Vec<usize>>()); + | ^^^^ method not found in `Iterate<{integer}, [closure@issue-41880.rs:26:24]>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-41888.rs b/tests/ui/issues/issue-41888.rs new file mode 100644 index 000000000..32df520f2 --- /dev/null +++ b/tests/ui/issues/issue-41888.rs @@ -0,0 +1,34 @@ +// run-pass +fn main() { let _ = g(Some(E::F(K))); } + +type R = Result<(), ()>; +struct K; + +enum E { + F(K), // must not be built-in type + #[allow(dead_code)] + G(Box<E>, Box<E>), +} + +fn translate(x: R) -> R { x } + +fn g(mut status: Option<E>) -> R { + loop { + match status { + Some(infix_or_postfix) => match infix_or_postfix { + E::F(_op) => { // <- must be captured by value + match Ok(()) { + Err(err) => return Err(err), + Ok(_) => {}, + }; + } + _ => (), + }, + _ => match translate(Err(())) { + Err(err) => return Err(err), + Ok(_) => {}, + } + } + status = None; + } +} diff --git a/tests/ui/issues/issue-41936-variance-coerce-unsized-cycle.rs b/tests/ui/issues/issue-41936-variance-coerce-unsized-cycle.rs new file mode 100644 index 000000000..3d678ba04 --- /dev/null +++ b/tests/ui/issues/issue-41936-variance-coerce-unsized-cycle.rs @@ -0,0 +1,30 @@ +// check-pass +#![allow(dead_code)] +// Regression test for #41936. The coerce-unsized trait check in +// coherence was using subtyping, which triggered variance +// computation, which failed because it required type info for fields +// that had not (yet) been computed. + +#![feature(unsize)] +#![feature(coerce_unsized)] + +use std::{marker,ops}; + +// Change the array to a non-array, and error disappears +// Adding a new field to the end keeps the error +struct LogDataBuf([u8;8]); + +struct Aref<T: ?Sized> +{ + // Inner structure triggers the error, removing the inner removes the message. + ptr: Box<ArefInner<T>>, +} +impl<T: ?Sized + marker::Unsize<U>, U: ?Sized> ops::CoerceUnsized<Aref<U>> for Aref<T> {} + +struct ArefInner<T: ?Sized> +{ + // Even with this field commented out, the error is raised. + data: T, +} + +fn main(){} diff --git a/tests/ui/issues/issue-41974.rs b/tests/ui/issues/issue-41974.rs new file mode 100644 index 000000000..10c363479 --- /dev/null +++ b/tests/ui/issues/issue-41974.rs @@ -0,0 +1,14 @@ +#[derive(Copy, Clone)] +struct Flags; + +trait A { +} + +impl<T> Drop for T where T: A { + //~^ ERROR E0120 + //~| ERROR E0210 + fn drop(&mut self) { + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-41974.stderr b/tests/ui/issues/issue-41974.stderr new file mode 100644 index 000000000..e249db9df --- /dev/null +++ b/tests/ui/issues/issue-41974.stderr @@ -0,0 +1,19 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`) + --> $DIR/issue-41974.rs:7:6 + | +LL | impl<T> Drop for T where T: A { + | ^ type parameter `T` must be used as the type parameter for some local type + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local + = note: only traits defined in the current crate can be implemented for a type parameter + +error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions + --> $DIR/issue-41974.rs:7:18 + | +LL | impl<T> Drop for T where T: A { + | ^ must be a struct, enum, or union in the current crate + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0120, E0210. +For more information about an error, try `rustc --explain E0120`. diff --git a/tests/ui/issues/issue-41998.rs b/tests/ui/issues/issue-41998.rs new file mode 100644 index 000000000..7696a3108 --- /dev/null +++ b/tests/ui/issues/issue-41998.rs @@ -0,0 +1,10 @@ +// check-pass + + +fn main() { + if ('x' as char) < ('y' as char) { + print!("x"); + } else { + print!("y"); + } +} diff --git a/tests/ui/issues/issue-42007.rs b/tests/ui/issues/issue-42007.rs new file mode 100644 index 000000000..a477e476e --- /dev/null +++ b/tests/ui/issues/issue-42007.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] +// aux-build:issue-42007-s.rs + +extern crate issue_42007_s; + +enum I { + E(issue_42007_s::E), +} + +fn main() {} diff --git a/tests/ui/issues/issue-4208.rs b/tests/ui/issues/issue-4208.rs new file mode 100644 index 000000000..3b01811a9 --- /dev/null +++ b/tests/ui/issues/issue-4208.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(dead_code)] +// aux-build:issue-4208-cc.rs + +// pretty-expanded FIXME #23616 + +extern crate numeric; +use numeric::{sin, Angle}; + +fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) } + +pub fn main() {} diff --git a/tests/ui/issues/issue-42106.rs b/tests/ui/issues/issue-42106.rs new file mode 100644 index 000000000..5e688693b --- /dev/null +++ b/tests/ui/issues/issue-42106.rs @@ -0,0 +1,10 @@ +fn do_something<T>(collection: &mut Vec<T>) { + let _a = &collection; + collection.swap(1, 2); //~ ERROR also borrowed as immutable + _a.use_ref(); +} + +fn main() { } + +trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } +impl<T> Fake for T { } diff --git a/tests/ui/issues/issue-42106.stderr b/tests/ui/issues/issue-42106.stderr new file mode 100644 index 000000000..73cf8652f --- /dev/null +++ b/tests/ui/issues/issue-42106.stderr @@ -0,0 +1,13 @@ +error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed as immutable + --> $DIR/issue-42106.rs:3:5 + | +LL | let _a = &collection; + | ----------- immutable borrow occurs here +LL | collection.swap(1, 2); + | ^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here +LL | _a.use_ref(); + | ------------ immutable borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/issues/issue-42148.rs b/tests/ui/issues/issue-42148.rs new file mode 100644 index 000000000..cb8c0d6ed --- /dev/null +++ b/tests/ui/issues/issue-42148.rs @@ -0,0 +1,6 @@ +// run-pass +struct Zst; + +fn main() { + unsafe { ::std::ptr::write_volatile(1 as *mut Zst, Zst) } +} diff --git a/tests/ui/issues/issue-42210.rs b/tests/ui/issues/issue-42210.rs new file mode 100644 index 000000000..01a5d5636 --- /dev/null +++ b/tests/ui/issues/issue-42210.rs @@ -0,0 +1,21 @@ +// run-pass +// Regression test for #42210. + +// compile-flags: -g +// ignore-asmjs wasm2js does not support source maps yet + +trait Foo { + fn foo() { } +} + +struct Bar; + +trait Baz { +} + +impl Foo for (Bar, dyn Baz) { } + + +fn main() { + <(Bar, dyn Baz) as Foo>::foo() +} diff --git a/tests/ui/issues/issue-4228.rs b/tests/ui/issues/issue-4228.rs new file mode 100644 index 000000000..491000b65 --- /dev/null +++ b/tests/ui/issues/issue-4228.rs @@ -0,0 +1,16 @@ +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo; + +impl Foo { + fn first() {} +} +impl Foo { + fn second() {} +} + +pub fn main() { + Foo::first(); + Foo::second(); +} diff --git a/tests/ui/issues/issue-42312.rs b/tests/ui/issues/issue-42312.rs new file mode 100644 index 000000000..426efcbf9 --- /dev/null +++ b/tests/ui/issues/issue-42312.rs @@ -0,0 +1,11 @@ +use std::ops::Deref; + +pub trait Foo { + fn baz(_: Self::Target) where Self: Deref {} + //~^ ERROR the size for values of type +} + +pub fn f(_: dyn ToString) {} +//~^ ERROR the size for values of type + +fn main() { } diff --git a/tests/ui/issues/issue-42312.stderr b/tests/ui/issues/issue-42312.stderr new file mode 100644 index 000000000..3ca6a2957 --- /dev/null +++ b/tests/ui/issues/issue-42312.stderr @@ -0,0 +1,37 @@ +error[E0277]: the size for values of type `<Self as Deref>::Target` cannot be known at compilation time + --> $DIR/issue-42312.rs:4:12 + | +LL | fn baz(_: Self::Target) where Self: Deref {} + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `<Self as Deref>::Target` + = help: unsized fn params are gated as an unstable feature +help: consider further restricting the associated type + | +LL | fn baz(_: Self::Target) where Self: Deref, <Self as Deref>::Target: Sized {} + | ++++++++++++++++++++++++++++++++ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn baz(_: &Self::Target) where Self: Deref {} + | + + +error[E0277]: the size for values of type `(dyn ToString + 'static)` cannot be known at compilation time + --> $DIR/issue-42312.rs:8:10 + | +LL | pub fn f(_: dyn ToString) {} + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn ToString + 'static)` + = help: unsized fn params are gated as an unstable feature +help: you can use `impl Trait` as the argument type + | +LL | pub fn f(_: impl ToString) {} + | ~~~~ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | pub fn f(_: &dyn ToString) {} + | + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-42453.rs b/tests/ui/issues/issue-42453.rs new file mode 100644 index 000000000..92fefceab --- /dev/null +++ b/tests/ui/issues/issue-42453.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +#[derive(Debug)] +struct builder; + +fn main() { + +} diff --git a/tests/ui/issues/issue-42467.rs b/tests/ui/issues/issue-42467.rs new file mode 100644 index 000000000..afa1bcd13 --- /dev/null +++ b/tests/ui/issues/issue-42467.rs @@ -0,0 +1,24 @@ +// check-pass +#![allow(dead_code)] +struct Foo<T>(T); + +struct IntoIter<T>(T); + +impl<'a, T: 'a> Iterator for IntoIter<T> { + type Item = (); + + fn next(&mut self) -> Option<()> { + None + } +} + +impl<T> IntoIterator for Foo<T> { + type Item = (); + type IntoIter = IntoIter<T>; + + fn into_iter(self) -> IntoIter<T> { + IntoIter(self.0) + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-4252.rs b/tests/ui/issues/issue-4252.rs new file mode 100644 index 000000000..0d47a7f0c --- /dev/null +++ b/tests/ui/issues/issue-4252.rs @@ -0,0 +1,33 @@ +// run-pass +trait X { + fn call<T: std::fmt::Debug>(&self, x: &T); + fn default_method<T: std::fmt::Debug>(&self, x: &T) { + println!("X::default_method {:?}", x); + } +} + +#[derive(Debug)] +struct Y(#[allow(unused_tuple_struct_fields)] isize); + +#[derive(Debug)] +struct Z<T: X+std::fmt::Debug> { + x: T +} + +impl X for Y { + fn call<T: std::fmt::Debug>(&self, x: &T) { + println!("X::call {:?} {:?}", self, x); + } +} + +impl<T: X + std::fmt::Debug> Drop for Z<T> { + fn drop(&mut self) { + // These statements used to cause an ICE. + self.x.call(self); + self.x.default_method(self); + } +} + +pub fn main() { + let _z = Z {x: Y(42)}; +} diff --git a/tests/ui/issues/issue-42552.rs b/tests/ui/issues/issue-42552.rs new file mode 100644 index 000000000..50d28a2f0 --- /dev/null +++ b/tests/ui/issues/issue-42552.rs @@ -0,0 +1,31 @@ +// run-pass +// Regression test for an obscure issue with the projection cache. + +fn into_iter<I: Iterator>(a: &I) -> Groups<I> { + Groups { _a: a } +} + +pub struct Groups<'a, I: 'a> { + _a: &'a I, +} + +impl<'a, I: Iterator> Iterator for Groups<'a, I> { + type Item = Group<'a, I>; + fn next(&mut self) -> Option<Self::Item> { + None + } +} + +pub struct Group<'a, I: Iterator + 'a> + where I::Item: 'a // <-- needed to trigger ICE! +{ + _phantom: &'a (), + _ice_trigger: I::Item, // <-- needed to trigger ICE! +} + + +fn main() { + let _ = into_iter(&[0].iter().map(|_| 0)).map(|grp| { + let _g = grp; + }); +} diff --git a/tests/ui/issues/issue-4265.rs b/tests/ui/issues/issue-4265.rs new file mode 100644 index 000000000..2596079d3 --- /dev/null +++ b/tests/ui/issues/issue-4265.rs @@ -0,0 +1,14 @@ +struct Foo { + baz: usize +} + +impl Foo { + fn bar() { + Foo { baz: 0 }.bar(); + } + + fn bar() { //~ ERROR duplicate definitions + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-4265.stderr b/tests/ui/issues/issue-4265.stderr new file mode 100644 index 000000000..8c7303f3c --- /dev/null +++ b/tests/ui/issues/issue-4265.stderr @@ -0,0 +1,12 @@ +error[E0592]: duplicate definitions with name `bar` + --> $DIR/issue-4265.rs:10:5 + | +LL | fn bar() { + | -------- other definition for `bar` +... +LL | fn bar() { + | ^^^^^^^^ duplicate definitions for `bar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/tests/ui/issues/issue-42755.rs b/tests/ui/issues/issue-42755.rs new file mode 100644 index 000000000..65796fc24 --- /dev/null +++ b/tests/ui/issues/issue-42755.rs @@ -0,0 +1,7 @@ +macro_rules! foo { + ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree +} + +foo!(a); + +fn main() {} diff --git a/tests/ui/issues/issue-42755.stderr b/tests/ui/issues/issue-42755.stderr new file mode 100644 index 000000000..12047e22f --- /dev/null +++ b/tests/ui/issues/issue-42755.stderr @@ -0,0 +1,8 @@ +error: repetition matches empty token tree + --> $DIR/issue-42755.rs:2:7 + | +LL | ($($p:vis)*) => {} + | ^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-42796.rs b/tests/ui/issues/issue-42796.rs new file mode 100644 index 000000000..5e83a1cd6 --- /dev/null +++ b/tests/ui/issues/issue-42796.rs @@ -0,0 +1,19 @@ +pub trait Mirror<Smoke> { + type Image; +} + +impl<T, Smoke> Mirror<Smoke> for T { + type Image = T; +} + +pub fn poison<S>(victim: String) where <String as Mirror<S>>::Image: Copy { + loop { drop(victim); } +} + +fn main() { + let s = "Hello!".to_owned(); + let mut s_copy = s; + s_copy.push_str("World!"); + "0wned!".to_owned(); + println!("{}", s); //~ ERROR borrow of moved value +} diff --git a/tests/ui/issues/issue-42796.stderr b/tests/ui/issues/issue-42796.stderr new file mode 100644 index 000000000..f2971df5d --- /dev/null +++ b/tests/ui/issues/issue-42796.stderr @@ -0,0 +1,20 @@ +error[E0382]: borrow of moved value: `s` + --> $DIR/issue-42796.rs:18:20 + | +LL | let s = "Hello!".to_owned(); + | - move occurs because `s` has type `String`, which does not implement the `Copy` trait +LL | let mut s_copy = s; + | - value moved here +... +LL | println!("{}", s); + | ^ value borrowed here after move + | + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider cloning the value if the performance cost is acceptable + | +LL | let mut s_copy = s.clone(); + | ++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-42880.rs b/tests/ui/issues/issue-42880.rs new file mode 100644 index 000000000..b61ba80e2 --- /dev/null +++ b/tests/ui/issues/issue-42880.rs @@ -0,0 +1,8 @@ +type Value = String; + +fn main() { + let f = |&Value::String(_)| (); //~ ERROR no associated item named + + let vec: Vec<Value> = Vec::new(); + vec.last().map(f); +} diff --git a/tests/ui/issues/issue-42880.stderr b/tests/ui/issues/issue-42880.stderr new file mode 100644 index 000000000..bec14429d --- /dev/null +++ b/tests/ui/issues/issue-42880.stderr @@ -0,0 +1,9 @@ +error[E0599]: no associated item named `String` found for struct `String` in the current scope + --> $DIR/issue-42880.rs:4:22 + | +LL | let f = |&Value::String(_)| (); + | ^^^^^^ associated item not found in `String` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-42956.rs b/tests/ui/issues/issue-42956.rs new file mode 100644 index 000000000..e6b3f9ffa --- /dev/null +++ b/tests/ui/issues/issue-42956.rs @@ -0,0 +1,26 @@ +// check-pass +#![allow(dead_code)] +#![allow(stable_features)] +#![feature(associated_consts)] + +impl A for i32 { + type Foo = u32; +} +impl B for u32 { + const BAR: i32 = 0; +} + +trait A { + type Foo: B; +} + +trait B { + const BAR: i32; +} + +fn generic<T: A>() { + // This panics if the universal function call syntax is used as well + println!("{}", T::Foo::BAR); +} + +fn main() {} diff --git a/tests/ui/issues/issue-43057.rs b/tests/ui/issues/issue-43057.rs new file mode 100644 index 000000000..4ce52af43 --- /dev/null +++ b/tests/ui/issues/issue-43057.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(unused)] + +macro_rules! column { + ($i:ident) => { + $i + }; +} + +fn foo() -> ! { + panic!(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-43162.rs b/tests/ui/issues/issue-43162.rs new file mode 100644 index 000000000..782eb4229 --- /dev/null +++ b/tests/ui/issues/issue-43162.rs @@ -0,0 +1,8 @@ +fn foo() -> bool { + //~^ ERROR E0308 + break true; //~ ERROR E0268 +} + +fn main() { + break {}; //~ ERROR E0268 +} diff --git a/tests/ui/issues/issue-43162.stderr b/tests/ui/issues/issue-43162.stderr new file mode 100644 index 000000000..40d920005 --- /dev/null +++ b/tests/ui/issues/issue-43162.stderr @@ -0,0 +1,24 @@ +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-43162.rs:3:5 + | +LL | break true; + | ^^^^^^^^^^ cannot `break` outside of a loop or labeled block + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-43162.rs:7:5 + | +LL | break {}; + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + +error[E0308]: mismatched types + --> $DIR/issue-43162.rs:1:13 + | +LL | fn foo() -> bool { + | --- ^^^^ expected `bool`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0268, E0308. +For more information about an error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-43205.rs b/tests/ui/issues/issue-43205.rs new file mode 100644 index 000000000..f47d5a347 --- /dev/null +++ b/tests/ui/issues/issue-43205.rs @@ -0,0 +1,5 @@ +// run-pass +fn main() { + let _ = &&[()][0]; + println!("{:?}", &[(),()][1]); +} diff --git a/tests/ui/issues/issue-43250.rs b/tests/ui/issues/issue-43250.rs new file mode 100644 index 000000000..24d70d296 --- /dev/null +++ b/tests/ui/issues/issue-43250.rs @@ -0,0 +1,13 @@ +fn main() { + let mut y; + const C: u32 = 0; + macro_rules! m { + ($a:expr) => { + let $a = 0; + } + } + m!(y); + //~^ ERROR arbitrary expressions aren't allowed in patterns + m!(C); + //~^ ERROR arbitrary expressions aren't allowed in patterns +} diff --git a/tests/ui/issues/issue-43250.stderr b/tests/ui/issues/issue-43250.stderr new file mode 100644 index 000000000..f729c5cf1 --- /dev/null +++ b/tests/ui/issues/issue-43250.stderr @@ -0,0 +1,14 @@ +error: arbitrary expressions aren't allowed in patterns + --> $DIR/issue-43250.rs:9:8 + | +LL | m!(y); + | ^ + +error: arbitrary expressions aren't allowed in patterns + --> $DIR/issue-43250.rs:11:8 + | +LL | m!(C); + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-43291.rs b/tests/ui/issues/issue-43291.rs new file mode 100644 index 000000000..52b629e35 --- /dev/null +++ b/tests/ui/issues/issue-43291.rs @@ -0,0 +1,9 @@ +// run-pass +pub fn main() { + assert_eq!(!0usize as *const (), foo(0, 1)); + assert_eq!(!0usize as *const (), (0i8 - 1) as *const ()); +} + +pub fn foo(a: i8, b: i8) -> *const () { + (a - b) as *const () +} diff --git a/tests/ui/issues/issue-4333.rs b/tests/ui/issues/issue-4333.rs new file mode 100644 index 000000000..3df319b68 --- /dev/null +++ b/tests/ui/issues/issue-4333.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(unused_must_use)] +// pretty-expanded FIXME #23616 + +use std::io; + +pub fn main() { + let stdout = &mut io::stdout() as &mut dyn io::Write; + stdout.write(b"Hello!"); +} diff --git a/tests/ui/issues/issue-4335.rs b/tests/ui/issues/issue-4335.rs new file mode 100644 index 000000000..c5914a17c --- /dev/null +++ b/tests/ui/issues/issue-4335.rs @@ -0,0 +1,13 @@ +#![feature(fn_traits)] + +fn id<T>(t: T) -> T { t } + +fn f<'r, T>(v: &'r T) -> Box<dyn FnMut() -> T + 'r> { + id(Box::new(|| *v)) + //~^ ERROR E0507 +} + +fn main() { + let v = &5; + println!("{}", f(v).call_mut(())); +} diff --git a/tests/ui/issues/issue-4335.stderr b/tests/ui/issues/issue-4335.stderr new file mode 100644 index 000000000..ecc1fa523 --- /dev/null +++ b/tests/ui/issues/issue-4335.stderr @@ -0,0 +1,13 @@ +error[E0507]: cannot move out of `*v`, as `v` is a captured variable in an `FnMut` closure + --> $DIR/issue-4335.rs:6:20 + | +LL | fn f<'r, T>(v: &'r T) -> Box<dyn FnMut() -> T + 'r> { + | - captured outer variable +LL | id(Box::new(|| *v)) + | -- ^^ move occurs because `*v` has type `T`, which does not implement the `Copy` trait + | | + | captured by this `FnMut` closure + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/issues/issue-43355.rs b/tests/ui/issues/issue-43355.rs new file mode 100644 index 000000000..bf819af79 --- /dev/null +++ b/tests/ui/issues/issue-43355.rs @@ -0,0 +1,19 @@ +pub trait Trait1<X> { + type Output; +} + +pub trait Trait2<X> {} + +pub struct A; + +impl<X, T> Trait1<X> for T where T: Trait2<X> { + type Output = (); +} + +impl<X> Trait1<Box<X>> for A { +//~^ ERROR conflicting implementations of trait +//~| downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A` + type Output = i32; +} + +fn main() {} diff --git a/tests/ui/issues/issue-43355.stderr b/tests/ui/issues/issue-43355.stderr new file mode 100644 index 000000000..57adc8ad5 --- /dev/null +++ b/tests/ui/issues/issue-43355.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `Trait1<Box<_>>` for type `A` + --> $DIR/issue-43355.rs:13:1 + | +LL | impl<X, T> Trait1<X> for T where T: Trait2<X> { + | -------------------------- first implementation here +... +LL | impl<X> Trait1<Box<X>> for A { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A` + | + = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/issues/issue-43357.rs b/tests/ui/issues/issue-43357.rs new file mode 100644 index 000000000..474c97655 --- /dev/null +++ b/tests/ui/issues/issue-43357.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(dead_code)] +trait Trait { + type Output; +} + +fn f<T: Trait>() { + std::mem::size_of::<T::Output>(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-43420-no-over-suggest.rs b/tests/ui/issues/issue-43420-no-over-suggest.rs new file mode 100644 index 000000000..4365bff5a --- /dev/null +++ b/tests/ui/issues/issue-43420-no-over-suggest.rs @@ -0,0 +1,9 @@ +// check that we substitute type parameters before we suggest anything - otherwise +// we would suggest function such as `as_slice` for the `&[u16]`. + +fn foo(b: &[u16]) {} + +fn main() { + let a: Vec<u8> = Vec::new(); + foo(&a); //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-43420-no-over-suggest.stderr b/tests/ui/issues/issue-43420-no-over-suggest.stderr new file mode 100644 index 000000000..58fd1121a --- /dev/null +++ b/tests/ui/issues/issue-43420-no-over-suggest.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-43420-no-over-suggest.rs:8:9 + | +LL | foo(&a); + | --- ^^ expected slice `[u16]`, found struct `Vec` + | | + | arguments to this function are incorrect + | + = note: expected reference `&[u16]` + found reference `&Vec<u8>` +note: function defined here + --> $DIR/issue-43420-no-over-suggest.rs:4:4 + | +LL | fn foo(b: &[u16]) {} + | ^^^ --------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-43424.rs b/tests/ui/issues/issue-43424.rs new file mode 100644 index 000000000..b3f76d8b0 --- /dev/null +++ b/tests/ui/issues/issue-43424.rs @@ -0,0 +1,12 @@ +#![allow(unused)] + +macro_rules! m { + ($attr_path: path) => { + #[$attr_path] + fn f() {} + } +} + +m!(inline<u8>); //~ ERROR: unexpected generic arguments in path + +fn main() {} diff --git a/tests/ui/issues/issue-43424.stderr b/tests/ui/issues/issue-43424.stderr new file mode 100644 index 000000000..8f59d7cc3 --- /dev/null +++ b/tests/ui/issues/issue-43424.stderr @@ -0,0 +1,8 @@ +error: unexpected generic arguments in path + --> $DIR/issue-43424.rs:10:10 + | +LL | m!(inline<u8>); + | ^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-43431.rs b/tests/ui/issues/issue-43431.rs new file mode 100644 index 000000000..e7ec35105 --- /dev/null +++ b/tests/ui/issues/issue-43431.rs @@ -0,0 +1,14 @@ +#![feature(fn_traits)] + +trait CallSingle<A, B> { + fn call(&self, a: A) -> B where Self: Sized, Self: Fn(A) -> B; +} + +impl<A, B, F: Fn(A) -> B> CallSingle<A, B> for F { + fn call(&self, a: A) -> B { + <Self as Fn(A) -> B>::call(self, (a,)) + //~^ ERROR associated type bindings are not allowed here + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-43431.stderr b/tests/ui/issues/issue-43431.stderr new file mode 100644 index 000000000..4edb52869 --- /dev/null +++ b/tests/ui/issues/issue-43431.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-43431.rs:9:27 + | +LL | <Self as Fn(A) -> B>::call(self, (a,)) + | ^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/issues/issue-43483.rs b/tests/ui/issues/issue-43483.rs new file mode 100644 index 000000000..76dd1c2eb --- /dev/null +++ b/tests/ui/issues/issue-43483.rs @@ -0,0 +1,16 @@ +// check-pass +#![allow(dead_code)] +#![allow(unused_variables)] +trait VecN { + const DIM: usize; +} + +trait Mat { + type Row: VecN; +} + +fn m<M: Mat>() { + let x = M::Row::DIM; +} + +fn main() {} diff --git a/tests/ui/issues/issue-43692.rs b/tests/ui/issues/issue-43692.rs new file mode 100644 index 000000000..a9999c226 --- /dev/null +++ b/tests/ui/issues/issue-43692.rs @@ -0,0 +1,5 @@ +// run-pass +fn main() { + assert_eq!('\u{10__FFFF}', '\u{10FFFF}'); + assert_eq!("\u{10_F0FF__}foo\u{1_0_0_0__}", "\u{10F0FF}foo\u{1000}"); +} diff --git a/tests/ui/issues/issue-43806.rs b/tests/ui/issues/issue-43806.rs new file mode 100644 index 000000000..8c8cccfb2 --- /dev/null +++ b/tests/ui/issues/issue-43806.rs @@ -0,0 +1,23 @@ +// check-pass + +#![deny(unused_results)] + +enum Void {} + +fn foo() {} + +fn bar() -> ! { + loop {} +} + +fn baz() -> Void { + loop {} +} + +fn qux() { + foo(); + bar(); + baz(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-43853.rs b/tests/ui/issues/issue-43853.rs new file mode 100644 index 000000000..dd42c1e3c --- /dev/null +++ b/tests/ui/issues/issue-43853.rs @@ -0,0 +1,17 @@ +// run-pass +// needs-unwind + +use std::panic; + +fn test() { + wait(|| panic!()); +} + +fn wait<T, F: FnOnce() -> T>(f: F) -> F::Output { + From::from(f()) +} + +fn main() { + let result = panic::catch_unwind(move || test()); + assert!(result.is_err()); +} diff --git a/tests/ui/issues/issue-4387.rs b/tests/ui/issues/issue-4387.rs new file mode 100644 index 000000000..84592f16a --- /dev/null +++ b/tests/ui/issues/issue-4387.rs @@ -0,0 +1,6 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let _foo = [0; 2*4]; +} diff --git a/tests/ui/issues/issue-43910.rs b/tests/ui/issues/issue-43910.rs new file mode 100644 index 000000000..d8c877329 --- /dev/null +++ b/tests/ui/issues/issue-43910.rs @@ -0,0 +1,7 @@ +// run-pass +#![deny(unused_variables)] + +fn main() { + #[allow(unused_variables)] + let x = 12; +} diff --git a/tests/ui/issues/issue-43923.rs b/tests/ui/issues/issue-43923.rs new file mode 100644 index 000000000..ad35a6685 --- /dev/null +++ b/tests/ui/issues/issue-43923.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +struct A<T: ?Sized> { ptr: T } + +fn foo<T>(x: &A<[T]>) {} + +fn main() { + let a = foo; + let b = A { ptr: [a, a, a] }; + a(&A { ptr: [()] }); +} diff --git a/tests/ui/issues/issue-43925.rs b/tests/ui/issues/issue-43925.rs new file mode 100644 index 000000000..1a2108871 --- /dev/null +++ b/tests/ui/issues/issue-43925.rs @@ -0,0 +1,4 @@ +#[link(name = "foo", cfg("rlib"))] //~ ERROR link cfg must have a single predicate argument +extern "C" {} + +fn main() {} diff --git a/tests/ui/issues/issue-43925.stderr b/tests/ui/issues/issue-43925.stderr new file mode 100644 index 000000000..b0ad25063 --- /dev/null +++ b/tests/ui/issues/issue-43925.stderr @@ -0,0 +1,8 @@ +error: link cfg must have a single predicate argument + --> $DIR/issue-43925.rs:1:22 + | +LL | #[link(name = "foo", cfg("rlib"))] + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-43926.rs b/tests/ui/issues/issue-43926.rs new file mode 100644 index 000000000..6d3003552 --- /dev/null +++ b/tests/ui/issues/issue-43926.rs @@ -0,0 +1,4 @@ +#[link(name = "foo", cfg())] //~ ERROR link cfg must have a single predicate argument +extern "C" {} + +fn main() {} diff --git a/tests/ui/issues/issue-43926.stderr b/tests/ui/issues/issue-43926.stderr new file mode 100644 index 000000000..f67f91a6b --- /dev/null +++ b/tests/ui/issues/issue-43926.stderr @@ -0,0 +1,8 @@ +error: link cfg must have a single predicate argument + --> $DIR/issue-43926.rs:1:22 + | +LL | #[link(name = "foo", cfg())] + | ^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-43988.rs b/tests/ui/issues/issue-43988.rs new file mode 100644 index 000000000..b114e8e03 --- /dev/null +++ b/tests/ui/issues/issue-43988.rs @@ -0,0 +1,36 @@ +#![feature(stmt_expr_attributes)] + +fn main() { + + #[inline] + let _a = 4; + //~^^ ERROR attribute should be applied to function or closure + + + #[inline(XYZ)] + let _b = 4; + //~^^ ERROR attribute should be applied to function or closure + + #[repr(nothing)] + let _x = 0; + //~^^ ERROR E0552 + + #[repr(something_not_real)] + loop { + () + }; + //~^^^^ ERROR E0552 + + #[repr] + let _y = "123"; + //~^^ ERROR malformed `repr` attribute + + fn foo() {} + + #[inline(ABC)] + foo(); + //~^^ ERROR attribute should be applied to function or closure + + let _z = #[repr] 1; + //~^ ERROR malformed `repr` attribute +} diff --git a/tests/ui/issues/issue-43988.stderr b/tests/ui/issues/issue-43988.stderr new file mode 100644 index 000000000..02c5dd5bf --- /dev/null +++ b/tests/ui/issues/issue-43988.stderr @@ -0,0 +1,56 @@ +error: malformed `repr` attribute input + --> $DIR/issue-43988.rs:24:5 + | +LL | #[repr] + | ^^^^^^^ help: must be of the form: `#[repr(C)]` + +error: malformed `repr` attribute input + --> $DIR/issue-43988.rs:34:14 + | +LL | let _z = #[repr] 1; + | ^^^^^^^ help: must be of the form: `#[repr(C)]` + +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-43988.rs:5:5 + | +LL | #[inline] + | ^^^^^^^^^ +LL | let _a = 4; + | ----------- not a function or closure + +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-43988.rs:10:5 + | +LL | #[inline(XYZ)] + | ^^^^^^^^^^^^^^ +LL | let _b = 4; + | ----------- not a function or closure + +error[E0552]: unrecognized representation hint + --> $DIR/issue-43988.rs:14:12 + | +LL | #[repr(nothing)] + | ^^^^^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` + +error[E0552]: unrecognized representation hint + --> $DIR/issue-43988.rs:18:12 + | +LL | #[repr(something_not_real)] + | ^^^^^^^^^^^^^^^^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` + +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-43988.rs:30:5 + | +LL | #[inline(ABC)] + | ^^^^^^^^^^^^^^ +LL | foo(); + | ----- not a function or closure + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0518, E0552. +For more information about an error, try `rustc --explain E0518`. diff --git a/tests/ui/issues/issue-44023.rs b/tests/ui/issues/issue-44023.rs new file mode 100644 index 000000000..e4320b7da --- /dev/null +++ b/tests/ui/issues/issue-44023.rs @@ -0,0 +1,4 @@ +pub fn main () {} + +fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-44023.stderr b/tests/ui/issues/issue-44023.stderr new file mode 100644 index 000000000..9e9701241 --- /dev/null +++ b/tests/ui/issues/issue-44023.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/issue-44023.rs:3:36 + | +LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { + | ------------------------ ^^^^^ expected `isize`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-44056.rs b/tests/ui/issues/issue-44056.rs new file mode 100644 index 000000000..a4903ed2c --- /dev/null +++ b/tests/ui/issues/issue-44056.rs @@ -0,0 +1,6 @@ +// build-pass (FIXME(55996): should be run on targets supporting avx) +// only-x86_64 +// no-prefer-dynamic +// compile-flags: -Ctarget-feature=+avx -Clto + +fn main() {} diff --git a/tests/ui/issues/issue-44078.rs b/tests/ui/issues/issue-44078.rs new file mode 100644 index 000000000..b8c0e285f --- /dev/null +++ b/tests/ui/issues/issue-44078.rs @@ -0,0 +1,3 @@ +fn main() { + "😊""; //~ ERROR unterminated double quote +} diff --git a/tests/ui/issues/issue-44078.stderr b/tests/ui/issues/issue-44078.stderr new file mode 100644 index 000000000..daf67219f --- /dev/null +++ b/tests/ui/issues/issue-44078.stderr @@ -0,0 +1,11 @@ +error[E0765]: unterminated double quote string + --> $DIR/issue-44078.rs:2:8 + | +LL | "😊""; + | _________^ +LL | | } + | |__^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0765`. diff --git a/tests/ui/issues/issue-44216-add-instant.rs b/tests/ui/issues/issue-44216-add-instant.rs new file mode 100644 index 000000000..78cfecf2f --- /dev/null +++ b/tests/ui/issues/issue-44216-add-instant.rs @@ -0,0 +1,10 @@ +// run-fail +// error-pattern:overflow +// ignore-emscripten no processes + +use std::time::{Instant, Duration}; + +fn main() { + let now = Instant::now(); + let _ = now + Duration::from_secs(u64::MAX); +} diff --git a/tests/ui/issues/issue-44216-add-system-time.rs b/tests/ui/issues/issue-44216-add-system-time.rs new file mode 100644 index 000000000..7e9a3f802 --- /dev/null +++ b/tests/ui/issues/issue-44216-add-system-time.rs @@ -0,0 +1,10 @@ +// run-fail +// error-pattern:overflow +// ignore-emscripten no processes + +use std::time::{Duration, SystemTime}; + +fn main() { + let now = SystemTime::now(); + let _ = now + Duration::from_secs(u64::MAX); +} diff --git a/tests/ui/issues/issue-44216-sub-instant.rs b/tests/ui/issues/issue-44216-sub-instant.rs new file mode 100644 index 000000000..e40f80d44 --- /dev/null +++ b/tests/ui/issues/issue-44216-sub-instant.rs @@ -0,0 +1,10 @@ +// run-fail +// error-pattern:overflow +// ignore-emscripten no processes + +use std::time::{Instant, Duration}; + +fn main() { + let now = Instant::now(); + let _ = now - Duration::from_secs(u64::MAX); +} diff --git a/tests/ui/issues/issue-44216-sub-system-time.rs b/tests/ui/issues/issue-44216-sub-system-time.rs new file mode 100644 index 000000000..2c5a000fa --- /dev/null +++ b/tests/ui/issues/issue-44216-sub-system-time.rs @@ -0,0 +1,10 @@ +// run-fail +// error-pattern:overflow +// ignore-emscripten no processes + +use std::time::{Duration, SystemTime}; + +fn main() { + let now = SystemTime::now(); + let _ = now - Duration::from_secs(u64::MAX); +} diff --git a/tests/ui/issues/issue-44239.fixed b/tests/ui/issues/issue-44239.fixed new file mode 100644 index 000000000..e6c29cee9 --- /dev/null +++ b/tests/ui/issues/issue-44239.fixed @@ -0,0 +1,11 @@ +// run-rustfix +#![allow(dead_code, non_upper_case_globals)] +fn main() { + const n: usize = 0; + + struct Foo; + impl Foo { + const N: usize = n; + //~^ ERROR attempt to use a non-constant value + } +} diff --git a/tests/ui/issues/issue-44239.rs b/tests/ui/issues/issue-44239.rs new file mode 100644 index 000000000..482ed194c --- /dev/null +++ b/tests/ui/issues/issue-44239.rs @@ -0,0 +1,11 @@ +// run-rustfix +#![allow(dead_code, non_upper_case_globals)] +fn main() { + let n: usize = 0; + + struct Foo; + impl Foo { + const N: usize = n; + //~^ ERROR attempt to use a non-constant value + } +} diff --git a/tests/ui/issues/issue-44239.stderr b/tests/ui/issues/issue-44239.stderr new file mode 100644 index 000000000..2a245c92c --- /dev/null +++ b/tests/ui/issues/issue-44239.stderr @@ -0,0 +1,12 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/issue-44239.rs:8:26 + | +LL | let n: usize = 0; + | ----- help: consider using `const` instead of `let`: `const n` +... +LL | const N: usize = n; + | ^ non-constant value + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/issues/issue-44247.rs b/tests/ui/issues/issue-44247.rs new file mode 100644 index 000000000..3544880fa --- /dev/null +++ b/tests/ui/issues/issue-44247.rs @@ -0,0 +1,19 @@ +// check-pass +#![allow(dead_code)] +trait T { + type X; + const X: Self::X; +} +fn foo<X: T>() { + let _: X::X = X::X; +} + +trait S { + const X: Self::X; + type X; +} +fn bar<X: S>() { + let _: X::X = X::X; +} + +fn main() {} diff --git a/tests/ui/issues/issue-44255.rs b/tests/ui/issues/issue-44255.rs new file mode 100644 index 000000000..224503204 --- /dev/null +++ b/tests/ui/issues/issue-44255.rs @@ -0,0 +1,29 @@ +// run-pass + +use std::marker::PhantomData; + +fn main() { + let _arr = [1; <Multiply<Five, Five>>::VAL]; +} + +trait TypeVal<T> { + const VAL: T; +} + +struct Five; + +impl TypeVal<usize> for Five { + const VAL: usize = 5; +} + +struct Multiply<N, M> { + _n: PhantomData<N>, + _m: PhantomData<M>, +} + +impl<N, M> TypeVal<usize> for Multiply<N, M> + where N: TypeVal<usize>, + M: TypeVal<usize>, +{ + const VAL: usize = N::VAL * M::VAL; +} diff --git a/tests/ui/issues/issue-44405.rs b/tests/ui/issues/issue-44405.rs new file mode 100644 index 000000000..d404b9044 --- /dev/null +++ b/tests/ui/issues/issue-44405.rs @@ -0,0 +1,22 @@ +use std::ops::Index; + +struct Test; +struct Container(Test); + +impl Test { + fn test(&mut self) {} +} + +impl<'a> Index<&'a bool> for Container { + type Output = Test; + + fn index(&self, _index: &'a bool) -> &Test { + &self.0 + } +} + +fn main() { + let container = Container(Test); + let mut val = true; + container[&mut val].test(); //~ ERROR: cannot borrow data +} diff --git a/tests/ui/issues/issue-44405.stderr b/tests/ui/issues/issue-44405.stderr new file mode 100644 index 000000000..626cb2999 --- /dev/null +++ b/tests/ui/issues/issue-44405.stderr @@ -0,0 +1,11 @@ +error[E0596]: cannot borrow data in an index of `Container` as mutable + --> $DIR/issue-44405.rs:21:5 + | +LL | container[&mut val].test(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | + = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Container` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/issues/issue-4464.rs b/tests/ui/issues/issue-4464.rs new file mode 100644 index 000000000..7ac107150 --- /dev/null +++ b/tests/ui/issues/issue-4464.rs @@ -0,0 +1,7 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +fn broken(v: &[u8], i: usize, j: usize) -> &[u8] { &v[i..j] } + +pub fn main() {} diff --git a/tests/ui/issues/issue-44730.rs b/tests/ui/issues/issue-44730.rs new file mode 100644 index 000000000..0493811b2 --- /dev/null +++ b/tests/ui/issues/issue-44730.rs @@ -0,0 +1,15 @@ +// check-pass +//! dox + +#![deny(missing_docs)] + +macro_rules! doc { + ($e:expr) => ( + #[doc = $e] + pub struct Foo; + ) +} + +doc!("a"); + +fn main() {} diff --git a/tests/ui/issues/issue-44851.rs b/tests/ui/issues/issue-44851.rs new file mode 100644 index 000000000..23daaeb0f --- /dev/null +++ b/tests/ui/issues/issue-44851.rs @@ -0,0 +1,15 @@ +// check-pass +macro_rules! a { + () => { "a" } +} + +macro_rules! b { + ($doc:expr) => { + #[doc = $doc] + pub struct B; + } +} + +b!(a!()); + +fn main() {} diff --git a/tests/ui/issues/issue-4517.rs b/tests/ui/issues/issue-4517.rs new file mode 100644 index 000000000..caf85d44a --- /dev/null +++ b/tests/ui/issues/issue-4517.rs @@ -0,0 +1,8 @@ +fn bar(int_param: usize) {} + +fn main() { + let foo: [u8; 4] = [1; 4]; + bar(foo); + //~^ ERROR mismatched types + //~| expected `usize`, found array `[u8; 4]` +} diff --git a/tests/ui/issues/issue-4517.stderr b/tests/ui/issues/issue-4517.stderr new file mode 100644 index 000000000..70b4ca5ec --- /dev/null +++ b/tests/ui/issues/issue-4517.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/issue-4517.rs:5:9 + | +LL | bar(foo); + | --- ^^^ expected `usize`, found array `[u8; 4]` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-4517.rs:1:4 + | +LL | fn bar(int_param: usize) {} + | ^^^ ---------------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-4541.rs b/tests/ui/issues/issue-4541.rs new file mode 100644 index 000000000..e7f26d021 --- /dev/null +++ b/tests/ui/issues/issue-4541.rs @@ -0,0 +1,22 @@ +// run-pass + +fn parse_args() -> String { + let args: Vec<_> = ::std::env::args().collect(); + let mut n = 0; + + while n < args.len() { + match &*args[n] { + "-v" => (), + s => { + return s.to_string(); + } + } + n += 1; + } + + return "".to_string() +} + +pub fn main() { + println!("{}", parse_args()); +} diff --git a/tests/ui/issues/issue-4542.rs b/tests/ui/issues/issue-4542.rs new file mode 100644 index 000000000..2386561c3 --- /dev/null +++ b/tests/ui/issues/issue-4542.rs @@ -0,0 +1,12 @@ +// run-pass +// pretty-expanded FIXME #23616 + +use std::env; + +pub fn main() { + for arg in env::args() { + match arg.clone() { + _s => { } + } + } +} diff --git a/tests/ui/issues/issue-45425.rs b/tests/ui/issues/issue-45425.rs new file mode 100644 index 000000000..10ce374ea --- /dev/null +++ b/tests/ui/issues/issue-45425.rs @@ -0,0 +1,12 @@ +// check-pass +#![allow(dead_code)] +use std::ops::Add; + +fn ref_add<T>(a: &T, b: &T) -> T +where + for<'x> &'x T: Add<&'x T, Output = T>, +{ + a + b +} + +fn main() {} diff --git a/tests/ui/issues/issue-4545.rs b/tests/ui/issues/issue-4545.rs new file mode 100644 index 000000000..86fcf9af2 --- /dev/null +++ b/tests/ui/issues/issue-4545.rs @@ -0,0 +1,7 @@ +// run-pass +// aux-build:issue-4545.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_4545 as somelib; +pub fn main() { somelib::mk::<isize>(); } diff --git a/tests/ui/issues/issue-45510.rs b/tests/ui/issues/issue-45510.rs new file mode 100644 index 000000000..9e104ce6c --- /dev/null +++ b/tests/ui/issues/issue-45510.rs @@ -0,0 +1,32 @@ +// Test overloaded resolution of fn_traits. +// run-pass + +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +#[derive(Debug, PartialEq, Eq)] +struct Ishmael; +#[derive(Debug, PartialEq, Eq)] +struct Maybe; +struct CallMe; + +impl FnOnce<(Ishmael,)> for CallMe { + type Output = Ishmael; + extern "rust-call" fn call_once(self, _args: (Ishmael,)) -> Ishmael { + println!("Split your lungs with blood and thunder!"); + Ishmael + } +} + +impl FnOnce<(Maybe,)> for CallMe { + type Output = Maybe; + extern "rust-call" fn call_once(self, _args: (Maybe,)) -> Maybe { + println!("So we just met, and this is crazy"); + Maybe + } +} + +fn main() { + assert_eq!(CallMe(Ishmael), Ishmael); + assert_eq!(CallMe(Maybe), Maybe); +} diff --git a/tests/ui/issues/issue-45562.fixed b/tests/ui/issues/issue-45562.fixed new file mode 100644 index 000000000..ac700fbd0 --- /dev/null +++ b/tests/ui/issues/issue-45562.fixed @@ -0,0 +1,6 @@ +// run-rustfix + +#[no_mangle] pub static RAH: usize = 5; +//~^ ERROR const items should never be `#[no_mangle]` + +fn main() {} diff --git a/tests/ui/issues/issue-45562.rs b/tests/ui/issues/issue-45562.rs new file mode 100644 index 000000000..eabb5a5ce --- /dev/null +++ b/tests/ui/issues/issue-45562.rs @@ -0,0 +1,6 @@ +// run-rustfix + +#[no_mangle] pub const RAH: usize = 5; +//~^ ERROR const items should never be `#[no_mangle]` + +fn main() {} diff --git a/tests/ui/issues/issue-45562.stderr b/tests/ui/issues/issue-45562.stderr new file mode 100644 index 000000000..be259d3f8 --- /dev/null +++ b/tests/ui/issues/issue-45562.stderr @@ -0,0 +1,12 @@ +error: const items should never be `#[no_mangle]` + --> $DIR/issue-45562.rs:3:14 + | +LL | #[no_mangle] pub const RAH: usize = 5; + | ---------^^^^^^^^^^^^^^^^ + | | + | help: try a static value: `pub static` + | + = note: `#[deny(no_mangle_const_items)]` on by default + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-45697-1.rs b/tests/ui/issues/issue-45697-1.rs new file mode 100644 index 000000000..b45f1170b --- /dev/null +++ b/tests/ui/issues/issue-45697-1.rs @@ -0,0 +1,25 @@ +// Test that assignments to an `&mut` pointer which is found in a +// borrowed (but otherwise non-aliasable) location is illegal. + +// compile-flags: -C overflow-checks=on + +struct S<'a> { + pointer: &'a mut isize +} + +fn copy_borrowed_ptr<'a>(p: &'a mut S<'a>) -> S<'a> { + S { pointer: &mut *p.pointer } +} + +fn main() { + let mut x = 1; + + { + let mut y = S { pointer: &mut x }; + let z = copy_borrowed_ptr(&mut y); + *y.pointer += 1; + //~^ ERROR cannot use `*y.pointer` because it was mutably borrowed [E0503] + //~| ERROR cannot assign to `*y.pointer` because it is borrowed [E0506] + *z.pointer += 1; + } +} diff --git a/tests/ui/issues/issue-45697-1.stderr b/tests/ui/issues/issue-45697-1.stderr new file mode 100644 index 000000000..30c69f196 --- /dev/null +++ b/tests/ui/issues/issue-45697-1.stderr @@ -0,0 +1,26 @@ +error[E0503]: cannot use `*y.pointer` because it was mutably borrowed + --> $DIR/issue-45697-1.rs:20:9 + | +LL | let z = copy_borrowed_ptr(&mut y); + | ------ borrow of `y` occurs here +LL | *y.pointer += 1; + | ^^^^^^^^^^^^^^^ use of borrowed `y` +... +LL | *z.pointer += 1; + | --------------- borrow later used here + +error[E0506]: cannot assign to `*y.pointer` because it is borrowed + --> $DIR/issue-45697-1.rs:20:9 + | +LL | let z = copy_borrowed_ptr(&mut y); + | ------ borrow of `*y.pointer` occurs here +LL | *y.pointer += 1; + | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here +... +LL | *z.pointer += 1; + | --------------- borrow later used here + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0503, E0506. +For more information about an error, try `rustc --explain E0503`. diff --git a/tests/ui/issues/issue-45697.rs b/tests/ui/issues/issue-45697.rs new file mode 100644 index 000000000..db6d1d8fa --- /dev/null +++ b/tests/ui/issues/issue-45697.rs @@ -0,0 +1,25 @@ +// Test that assignments to an `&mut` pointer which is found in a +// borrowed (but otherwise non-aliasable) location is illegal. + +// compile-flags: -C overflow-checks=off + +struct S<'a> { + pointer: &'a mut isize +} + +fn copy_borrowed_ptr<'a>(p: &'a mut S<'a>) -> S<'a> { + S { pointer: &mut *p.pointer } +} + +fn main() { + let mut x = 1; + + { + let mut y = S { pointer: &mut x }; + let z = copy_borrowed_ptr(&mut y); + *y.pointer += 1; + //~^ ERROR cannot use `*y.pointer` because it was mutably borrowed [E0503] + //~| ERROR cannot assign to `*y.pointer` because it is borrowed [E0506] + *z.pointer += 1; + } +} diff --git a/tests/ui/issues/issue-45697.stderr b/tests/ui/issues/issue-45697.stderr new file mode 100644 index 000000000..26749d36f --- /dev/null +++ b/tests/ui/issues/issue-45697.stderr @@ -0,0 +1,26 @@ +error[E0503]: cannot use `*y.pointer` because it was mutably borrowed + --> $DIR/issue-45697.rs:20:9 + | +LL | let z = copy_borrowed_ptr(&mut y); + | ------ borrow of `y` occurs here +LL | *y.pointer += 1; + | ^^^^^^^^^^^^^^^ use of borrowed `y` +... +LL | *z.pointer += 1; + | --------------- borrow later used here + +error[E0506]: cannot assign to `*y.pointer` because it is borrowed + --> $DIR/issue-45697.rs:20:9 + | +LL | let z = copy_borrowed_ptr(&mut y); + | ------ borrow of `*y.pointer` occurs here +LL | *y.pointer += 1; + | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here +... +LL | *z.pointer += 1; + | --------------- borrow later used here + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0503, E0506. +For more information about an error, try `rustc --explain E0503`. diff --git a/tests/ui/issues/issue-45730.rs b/tests/ui/issues/issue-45730.rs new file mode 100644 index 000000000..3776759fe --- /dev/null +++ b/tests/ui/issues/issue-45730.rs @@ -0,0 +1,9 @@ +use std::fmt; +fn main() { + let x: *const _ = 0 as _; //~ ERROR cannot cast + + let x: *const _ = 0 as *const _; //~ ERROR cannot cast + let y: Option<*const dyn fmt::Debug> = Some(x) as _; + + let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast +} diff --git a/tests/ui/issues/issue-45730.stderr b/tests/ui/issues/issue-45730.stderr new file mode 100644 index 000000000..d00f3d91b --- /dev/null +++ b/tests/ui/issues/issue-45730.stderr @@ -0,0 +1,27 @@ +error[E0641]: cannot cast to a pointer of an unknown kind + --> $DIR/issue-45730.rs:3:28 + | +LL | let x: *const _ = 0 as _; + | ^ needs more type information + | + = note: the type information given here is insufficient to check whether the pointer cast is valid + +error[E0641]: cannot cast to a pointer of an unknown kind + --> $DIR/issue-45730.rs:5:28 + | +LL | let x: *const _ = 0 as *const _; + | ^^^^^^^^ needs more type information + | + = note: the type information given here is insufficient to check whether the pointer cast is valid + +error[E0641]: cannot cast to a pointer of an unknown kind + --> $DIR/issue-45730.rs:8:44 + | +LL | let x = 0 as *const i32 as *const _ as *mut _; + | ^^^^^^ needs more type information + | + = note: the type information given here is insufficient to check whether the pointer cast is valid + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0641`. diff --git a/tests/ui/issues/issue-45731.rs b/tests/ui/issues/issue-45731.rs new file mode 100644 index 000000000..5c5ac5987 --- /dev/null +++ b/tests/ui/issues/issue-45731.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(unused_variables)] +// compile-flags:--test -g +// ignore-asmjs wasm2js does not support source maps yet + +#[cfg(target_os = "macos")] +#[test] +fn simple_test() { + use std::{env, panic, fs}; + + // Find our dSYM and replace the DWARF binary with an empty file + let mut dsym_path = env::current_exe().unwrap(); + let executable_name = dsym_path.file_name().unwrap().to_str().unwrap().to_string(); + assert!(dsym_path.pop()); // Pop executable + dsym_path.push(format!("{}.dSYM/Contents/Resources/DWARF/{0}", executable_name)); + { + let file = fs::OpenOptions::new().read(false).write(true).truncate(true).create(false) + .open(&dsym_path).unwrap(); + } + + env::set_var("RUST_BACKTRACE", "1"); + + // We don't need to die of panic, just trigger a backtrace + let _ = panic::catch_unwind(|| { + assert!(false); + }); +} diff --git a/tests/ui/issues/issue-45801.rs b/tests/ui/issues/issue-45801.rs new file mode 100644 index 000000000..780baa896 --- /dev/null +++ b/tests/ui/issues/issue-45801.rs @@ -0,0 +1,25 @@ +struct Params; + +pub trait Plugin<E: ?Sized> { + type Error; +} + +pub trait Pluggable { + fn get_ref<P: Plugin<Self>>(&mut self) -> Option<P::Error> { + None + } +} + +struct Foo; +impl Plugin<Foo> for Params { + type Error = (); +} + +impl<T: Copy> Pluggable for T {} + +fn handle(req: &mut i32) { + req.get_ref::<Params>(); + //~^ ERROR the trait bound `Params: Plugin<i32>` is not satisfied +} + +fn main() {} diff --git a/tests/ui/issues/issue-45801.stderr b/tests/ui/issues/issue-45801.stderr new file mode 100644 index 000000000..8967f49df --- /dev/null +++ b/tests/ui/issues/issue-45801.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `Params: Plugin<i32>` is not satisfied + --> $DIR/issue-45801.rs:21:9 + | +LL | req.get_ref::<Params>(); + | ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params` + | + = help: the trait `Plugin<Foo>` is implemented for `Params` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-45965.rs b/tests/ui/issues/issue-45965.rs new file mode 100644 index 000000000..15649f777 --- /dev/null +++ b/tests/ui/issues/issue-45965.rs @@ -0,0 +1,4 @@ +fn main() { + let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 }; + //~^ ERROR expected function, found `{float}` +} diff --git a/tests/ui/issues/issue-45965.stderr b/tests/ui/issues/issue-45965.stderr new file mode 100644 index 000000000..f3eaa9176 --- /dev/null +++ b/tests/ui/issues/issue-45965.stderr @@ -0,0 +1,11 @@ +error[E0618]: expected function, found `{float}` + --> $DIR/issue-45965.rs:2:30 + | +LL | let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 }; + | ^^^---------- + | | + | call expression requires function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-46069.rs b/tests/ui/issues/issue-46069.rs new file mode 100644 index 000000000..c418128c1 --- /dev/null +++ b/tests/ui/issues/issue-46069.rs @@ -0,0 +1,23 @@ +// run-pass +use std::iter::{Fuse, Cloned}; +use std::slice::Iter; + +struct Foo<'a, T: 'a>(#[allow(unused_tuple_struct_fields)] &'a T); +impl<'a, T: 'a> Copy for Foo<'a, T> {} +impl<'a, T: 'a> Clone for Foo<'a, T> { + fn clone(&self) -> Self { *self } +} + +fn copy_ex() { + let s = 2; + let k1 = || s; + let upvar = Foo(&k1); + let k = || upvar; + k(); +} + +fn main() { + let _f: *mut <Fuse<Cloned<Iter<u8>>> as Iterator>::Item = std::ptr::null_mut(); + + copy_ex(); +} diff --git a/tests/ui/issues/issue-46101.rs b/tests/ui/issues/issue-46101.rs new file mode 100644 index 000000000..ab3d30d40 --- /dev/null +++ b/tests/ui/issues/issue-46101.rs @@ -0,0 +1,6 @@ +trait Foo {} +#[derive(Foo::Anything)] //~ ERROR failed to resolve: partially resolved path in a derive macro + //~| ERROR failed to resolve: partially resolved path in a derive macro +struct S; + +fn main() {} diff --git a/tests/ui/issues/issue-46101.stderr b/tests/ui/issues/issue-46101.stderr new file mode 100644 index 000000000..40295b8a1 --- /dev/null +++ b/tests/ui/issues/issue-46101.stderr @@ -0,0 +1,15 @@ +error[E0433]: failed to resolve: partially resolved path in a derive macro + --> $DIR/issue-46101.rs:2:10 + | +LL | #[derive(Foo::Anything)] + | ^^^^^^^^^^^^^ partially resolved path in a derive macro + +error[E0433]: failed to resolve: partially resolved path in a derive macro + --> $DIR/issue-46101.rs:2:10 + | +LL | #[derive(Foo::Anything)] + | ^^^^^^^^^^^^^ partially resolved path in a derive macro + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/issues/issue-46302.rs b/tests/ui/issues/issue-46302.rs new file mode 100644 index 000000000..ba681d84e --- /dev/null +++ b/tests/ui/issues/issue-46302.rs @@ -0,0 +1,9 @@ +fn foo() { + let s = "abc"; + let u: &str = if true { s[..2] } else { s }; + //~^ ERROR mismatched types +} + +fn main() { + foo(); +} diff --git a/tests/ui/issues/issue-46302.stderr b/tests/ui/issues/issue-46302.stderr new file mode 100644 index 000000000..a6f97c3c9 --- /dev/null +++ b/tests/ui/issues/issue-46302.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-46302.rs:3:27 + | +LL | let u: &str = if true { s[..2] } else { s }; + | ^^^^^^ + | | + | expected `&str`, found `str` + | help: consider borrowing here: `&s[..2]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-46311.rs b/tests/ui/issues/issue-46311.rs new file mode 100644 index 000000000..1233a49c5 --- /dev/null +++ b/tests/ui/issues/issue-46311.rs @@ -0,0 +1,4 @@ +fn main() { + 'break: loop { //~ ERROR invalid label name `'break` + } +} diff --git a/tests/ui/issues/issue-46311.stderr b/tests/ui/issues/issue-46311.stderr new file mode 100644 index 000000000..d72d6477d --- /dev/null +++ b/tests/ui/issues/issue-46311.stderr @@ -0,0 +1,8 @@ +error: invalid label name `'break` + --> $DIR/issue-46311.rs:2:5 + | +LL | 'break: loop { + | ^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-46332.rs b/tests/ui/issues/issue-46332.rs new file mode 100644 index 000000000..bed74e313 --- /dev/null +++ b/tests/ui/issues/issue-46332.rs @@ -0,0 +1,11 @@ +// Original Levenshtein distance for both of this is 1. We improved accuracy with +// additional case insensitive comparison. + +struct TyUint {} + +struct TyInt {} + +fn main() { + TyUInt {}; + //~^ ERROR cannot find struct, variant or union type `TyUInt` in this scope +} diff --git a/tests/ui/issues/issue-46332.stderr b/tests/ui/issues/issue-46332.stderr new file mode 100644 index 000000000..890ef8014 --- /dev/null +++ b/tests/ui/issues/issue-46332.stderr @@ -0,0 +1,12 @@ +error[E0422]: cannot find struct, variant or union type `TyUInt` in this scope + --> $DIR/issue-46332.rs:9:5 + | +LL | struct TyUint {} + | ------------- similarly named struct `TyUint` defined here +... +LL | TyUInt {}; + | ^^^^^^ help: a struct with a similar name exists (notice the capitalization): `TyUint` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0422`. diff --git a/tests/ui/issues/issue-46438.rs b/tests/ui/issues/issue-46438.rs new file mode 100644 index 000000000..d78b95846 --- /dev/null +++ b/tests/ui/issues/issue-46438.rs @@ -0,0 +1,13 @@ +macro_rules! m { + ($my_type: ty) => { + impl $my_type for u8 {} + } +} + +trait Tr {} + +m!(Tr); + +m!(&'static u8); //~ ERROR expected a trait, found type + +fn main() {} diff --git a/tests/ui/issues/issue-46438.stderr b/tests/ui/issues/issue-46438.stderr new file mode 100644 index 000000000..c1fad44b8 --- /dev/null +++ b/tests/ui/issues/issue-46438.stderr @@ -0,0 +1,8 @@ +error: expected a trait, found type + --> $DIR/issue-46438.rs:11:4 + | +LL | m!(&'static u8); + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-46471-1.rs b/tests/ui/issues/issue-46471-1.rs new file mode 100644 index 000000000..aa161d40f --- /dev/null +++ b/tests/ui/issues/issue-46471-1.rs @@ -0,0 +1,8 @@ +fn main() { + let y = { + let mut z = 0; + &mut z + }; + //~^^ ERROR `z` does not live long enough [E0597] + println!("{}", y); +} diff --git a/tests/ui/issues/issue-46471-1.stderr b/tests/ui/issues/issue-46471-1.stderr new file mode 100644 index 000000000..b09f31729 --- /dev/null +++ b/tests/ui/issues/issue-46471-1.stderr @@ -0,0 +1,14 @@ +error[E0597]: `z` does not live long enough + --> $DIR/issue-46471-1.rs:4:9 + | +LL | &mut z + | ^^^^^^ + | | + | borrowed value does not live long enough + | borrow later used here +LL | }; + | - `z` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/issues/issue-46472.rs b/tests/ui/issues/issue-46472.rs new file mode 100644 index 000000000..b9e20e8db --- /dev/null +++ b/tests/ui/issues/issue-46472.rs @@ -0,0 +1,6 @@ +fn bar<'a>() -> &'a mut u32 { + &mut 4 + //~^ ERROR cannot return reference to temporary value [E0515] +} + +fn main() { } diff --git a/tests/ui/issues/issue-46472.stderr b/tests/ui/issues/issue-46472.stderr new file mode 100644 index 000000000..6e561e03a --- /dev/null +++ b/tests/ui/issues/issue-46472.stderr @@ -0,0 +1,12 @@ +error[E0515]: cannot return reference to temporary value + --> $DIR/issue-46472.rs:2:5 + | +LL | &mut 4 + | ^^^^^- + | | | + | | temporary value created here + | returns a reference to data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-46604.rs b/tests/ui/issues/issue-46604.rs new file mode 100644 index 000000000..6ec6e7bdc --- /dev/null +++ b/tests/ui/issues/issue-46604.rs @@ -0,0 +1,7 @@ +static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //~ ERROR mutable references are not allowed +fn write<T: AsRef<[u8]>>(buffer: T) { } + +fn main() { + write(&buf); + buf[0]=2; //~ ERROR E0594 +} diff --git a/tests/ui/issues/issue-46604.stderr b/tests/ui/issues/issue-46604.stderr new file mode 100644 index 000000000..7faa2d79b --- /dev/null +++ b/tests/ui/issues/issue-46604.stderr @@ -0,0 +1,16 @@ +error[E0764]: mutable references are not allowed in the final value of statics + --> $DIR/issue-46604.rs:1:25 + | +LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item + --> $DIR/issue-46604.rs:6:5 + | +LL | buf[0]=2; + | ^^^^^^^^ cannot assign + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0594, E0764. +For more information about an error, try `rustc --explain E0594`. diff --git a/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed new file mode 100644 index 000000000..8668d8acd --- /dev/null +++ b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed @@ -0,0 +1,16 @@ +// run-rustfix + +#![allow(unused)] + +fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { + and_yet + 1 +} + +fn main() { + let behold: isize = 2; + let with_tears: usize = 3; + light_flows_our_war_of_mocking_words(&(behold as usize)); + //~^ ERROR mismatched types [E0308] + light_flows_our_war_of_mocking_words(&(with_tears + 4)); + //~^ ERROR mismatched types [E0308] +} diff --git a/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs new file mode 100644 index 000000000..c8494612c --- /dev/null +++ b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs @@ -0,0 +1,16 @@ +// run-rustfix + +#![allow(unused)] + +fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { + and_yet + 1 +} + +fn main() { + let behold: isize = 2; + let with_tears: usize = 3; + light_flows_our_war_of_mocking_words(behold as usize); + //~^ ERROR mismatched types [E0308] + light_flows_our_war_of_mocking_words(with_tears + 4); + //~^ ERROR mismatched types [E0308] +} diff --git a/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr new file mode 100644 index 000000000..e874ded8e --- /dev/null +++ b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr @@ -0,0 +1,35 @@ +error[E0308]: mismatched types + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:12:42 + | +LL | light_flows_our_war_of_mocking_words(behold as usize); + | ------------------------------------ ^^^^^^^^^^^^^^^ + | | | + | | expected `&usize`, found `usize` + | | help: consider borrowing here: `&(behold as usize)` + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:5:4 + | +LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- + +error[E0308]: mismatched types + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:14:42 + | +LL | light_flows_our_war_of_mocking_words(with_tears + 4); + | ------------------------------------ ^^^^^^^^^^^^^^ + | | | + | | expected `&usize`, found `usize` + | | help: consider borrowing here: `&(with_tears + 4)` + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:5:4 + | +LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-46771.rs b/tests/ui/issues/issue-46771.rs new file mode 100644 index 000000000..22be8d6af --- /dev/null +++ b/tests/ui/issues/issue-46771.rs @@ -0,0 +1,4 @@ +fn main() { + struct Foo; + (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `Foo` +} diff --git a/tests/ui/issues/issue-46771.stderr b/tests/ui/issues/issue-46771.stderr new file mode 100644 index 000000000..512827b2d --- /dev/null +++ b/tests/ui/issues/issue-46771.stderr @@ -0,0 +1,13 @@ +error[E0618]: expected function, found `Foo` + --> $DIR/issue-46771.rs:3:23 + | +LL | struct Foo; + | ---------- `Foo` defined here +LL | (1 .. 2).find(|_| Foo(0) == 0); + | ^^^--- + | | + | call expression requires function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0618`. diff --git a/tests/ui/issues/issue-46855.rs b/tests/ui/issues/issue-46855.rs new file mode 100644 index 000000000..aa6378f85 --- /dev/null +++ b/tests/ui/issues/issue-46855.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(dead_code)] +// compile-flags: -Zmir-opt-level=1 + +use std::mem; + +#[derive(Copy, Clone)] +enum Never {} + +union Foo { + a: u64, + b: Never +} + +fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 } + +fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x } + +fn main() { + println!("{}", mem::size_of::<Foo>()); + + let f = [Foo { a: 42 }, Foo { a: 10 }]; + println!("{:?}", unsafe { f[0].a }); +} diff --git a/tests/ui/issues/issue-46964.rs b/tests/ui/issues/issue-46964.rs new file mode 100644 index 000000000..28fa92f20 --- /dev/null +++ b/tests/ui/issues/issue-46964.rs @@ -0,0 +1,19 @@ +// check-pass +mod my_mod { + #[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash)] + pub struct Name<'a> { + source: &'a str, + } + + pub const JSON: Name = Name { source: "JSON" }; +} + +pub fn crash() -> bool { + match (my_mod::JSON, None) { + (_, Some(my_mod::JSON)) => true, + (my_mod::JSON, None) => true, + _ => false, + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-46983.rs b/tests/ui/issues/issue-46983.rs new file mode 100644 index 000000000..4bd49a879 --- /dev/null +++ b/tests/ui/issues/issue-46983.rs @@ -0,0 +1,6 @@ +fn foo(x: &u32) -> &'static u32 { + &*x + //~^ ERROR lifetime may not live long enough +} + +fn main() {} diff --git a/tests/ui/issues/issue-46983.stderr b/tests/ui/issues/issue-46983.stderr new file mode 100644 index 000000000..38a219bbd --- /dev/null +++ b/tests/ui/issues/issue-46983.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/issue-46983.rs:2:5 + | +LL | fn foo(x: &u32) -> &'static u32 { + | - let's call the lifetime of this reference `'1` +LL | &*x + | ^^^ returning this value requires that `'1` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs new file mode 100644 index 000000000..6cd1f1443 --- /dev/null +++ b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs @@ -0,0 +1,12 @@ +type Guilty = bool; +type FineDollars = u32; + +struct Verdict(Guilty, Option<FineDollars>); + +fn main() { + let justice = Verdict(true, Some(2718)); + let _condemned = justice.00; + //~^ ERROR no field `00` on type `Verdict` + let _punishment = justice.001; + //~^ ERROR no field `001` on type `Verdict` +} diff --git a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr new file mode 100644 index 000000000..5e1b816de --- /dev/null +++ b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr @@ -0,0 +1,17 @@ +error[E0609]: no field `00` on type `Verdict` + --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:8:30 + | +LL | let _condemned = justice.00; + | ^^ help: a field with a similar name exists: `0` + +error[E0609]: no field `001` on type `Verdict` + --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:10:31 + | +LL | let _punishment = justice.001; + | ^^^ unknown field + | + = note: available fields are: `0`, `1` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-47094.rs b/tests/ui/issues/issue-47094.rs new file mode 100644 index 000000000..c5d37feb1 --- /dev/null +++ b/tests/ui/issues/issue-47094.rs @@ -0,0 +1,16 @@ +#[repr(C, u8)] //~ ERROR conflicting representation hints +//~^ WARN this was previously accepted +enum Foo { + A, + B, +} + +#[repr(C)] //~ ERROR conflicting representation hints +//~^ WARN this was previously accepted +#[repr(u8)] +enum Bar { + A, + B, +} + +fn main() {} diff --git a/tests/ui/issues/issue-47094.stderr b/tests/ui/issues/issue-47094.stderr new file mode 100644 index 000000000..970e31847 --- /dev/null +++ b/tests/ui/issues/issue-47094.stderr @@ -0,0 +1,25 @@ +error[E0566]: conflicting representation hints + --> $DIR/issue-47094.rs:1:8 + | +LL | #[repr(C, u8)] + | ^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585> + = note: `#[deny(conflicting_repr_hints)]` on by default + +error[E0566]: conflicting representation hints + --> $DIR/issue-47094.rs:8:8 + | +LL | #[repr(C)] + | ^ +LL | +LL | #[repr(u8)] + | ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/68585> + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0566`. diff --git a/tests/ui/issues/issue-47184.rs b/tests/ui/issues/issue-47184.rs new file mode 100644 index 000000000..2f78ce000 --- /dev/null +++ b/tests/ui/issues/issue-47184.rs @@ -0,0 +1,4 @@ +fn main() { + let _vec: Vec<&'static String> = vec![&String::new()]; + //~^ ERROR temporary value dropped while borrowed [E0716] +} diff --git a/tests/ui/issues/issue-47184.stderr b/tests/ui/issues/issue-47184.stderr new file mode 100644 index 000000000..c2c7df7a3 --- /dev/null +++ b/tests/ui/issues/issue-47184.stderr @@ -0,0 +1,12 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/issue-47184.rs:2:44 + | +LL | let _vec: Vec<&'static String> = vec![&String::new()]; + | -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement + | | | + | | creates a temporary value which is freed while still in use + | type annotation requires that borrow lasts for `'static` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/issues/issue-47309.rs b/tests/ui/issues/issue-47309.rs new file mode 100644 index 000000000..abed9687b --- /dev/null +++ b/tests/ui/issues/issue-47309.rs @@ -0,0 +1,21 @@ +// Make sure that the mono-item collector does not crash when trying to +// instantiate a default impl of a method with lifetime parameters. +// See https://github.com/rust-lang/rust/issues/47309 + +// compile-flags:-Clink-dead-code +// build-pass + +#![crate_type="rlib"] + +pub trait EnvFuture { + type Item; + + fn boxed_result<'a>(self) where Self: Sized, Self::Item: 'a, { + } +} + +struct Foo; + +impl<'a> EnvFuture for &'a Foo { + type Item = (); +} diff --git a/tests/ui/issues/issue-4734.rs b/tests/ui/issues/issue-4734.rs new file mode 100644 index 000000000..29c965d7f --- /dev/null +++ b/tests/ui/issues/issue-4734.rs @@ -0,0 +1,37 @@ +// run-pass +#![allow(dead_code)] +// Ensures that destructors are run for expressions of the form "e;" where +// `e` is a type which requires a destructor. + + +#![allow(path_statements)] + +struct A { n: isize } +struct B; + +static mut NUM_DROPS: usize = 0; + +impl Drop for A { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +impl Drop for B { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +fn main() { + assert_eq!(unsafe { NUM_DROPS }, 0); + { let _a = A { n: 1 }; } + assert_eq!(unsafe { NUM_DROPS }, 1); + { A { n: 3 }; } + assert_eq!(unsafe { NUM_DROPS }, 2); + + { let _b = B; } + assert_eq!(unsafe { NUM_DROPS }, 3); + { B; } + assert_eq!(unsafe { NUM_DROPS }, 4); +} diff --git a/tests/ui/issues/issue-4735.rs b/tests/ui/issues/issue-4735.rs new file mode 100644 index 000000000..3ea4b01cd --- /dev/null +++ b/tests/ui/issues/issue-4735.rs @@ -0,0 +1,19 @@ +// run-pass +// pretty-expanded FIXME #23616 + +use std::mem::transmute; + +struct NonCopyable(*const u8); + +impl Drop for NonCopyable { + fn drop(&mut self) { + let NonCopyable(p) = *self; + let _v = unsafe { transmute::<*const u8, Box<isize>>(p) }; + } +} + +pub fn main() { + let t = Box::new(0); + let p = unsafe { transmute::<Box<isize>, *const u8>(t) }; + let _z = NonCopyable(p); +} diff --git a/tests/ui/issues/issue-4736.rs b/tests/ui/issues/issue-4736.rs new file mode 100644 index 000000000..799d2d480 --- /dev/null +++ b/tests/ui/issues/issue-4736.rs @@ -0,0 +1,5 @@ +struct NonCopyable(()); + +fn main() { + let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p` +} diff --git a/tests/ui/issues/issue-4736.stderr b/tests/ui/issues/issue-4736.stderr new file mode 100644 index 000000000..2a1f1819c --- /dev/null +++ b/tests/ui/issues/issue-4736.stderr @@ -0,0 +1,17 @@ +error[E0560]: struct `NonCopyable` has no field named `p` + --> $DIR/issue-4736.rs:4:26 + | +LL | struct NonCopyable(()); + | ----------- `NonCopyable` defined here +... +LL | let z = NonCopyable{ p: () }; + | ^ field does not exist + | +help: `NonCopyable` is a tuple struct, use the appropriate syntax + | +LL | let z = NonCopyable(/* fields */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0560`. diff --git a/tests/ui/issues/issue-47364.rs b/tests/ui/issues/issue-47364.rs new file mode 100644 index 000000000..b524354d9 --- /dev/null +++ b/tests/ui/issues/issue-47364.rs @@ -0,0 +1,59 @@ +// run-pass +#![allow(unused_variables)] +// compile-flags: -C codegen-units=8 -O +#![allow(non_snake_case)] + +fn main() { + nom_sql::selection(b"x "); +} + +pub enum Err<P>{ + Position(P), + NodePosition(u32), +} + +pub enum IResult<I,O> { + Done(I,O), + Error(Err<I>), + Incomplete(u32, u64) +} + +pub fn multispace<T: Copy>(input: T) -> ::IResult<i8, i8> { + ::IResult::Done(0, 0) +} + +mod nom_sql { + fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option<String>> { + let X = match ::multispace(i) { + ::IResult::Done(..) => ::IResult::Done(i, None::<String>), + _ => ::IResult::Error(::Err::NodePosition(0)), + }; + match X { + ::IResult::Done(_, _) => ::IResult::Done(i, None), + _ => X + } + } + + pub fn selection(i: &[u8]) { + let Y = match { + match { + where_clause(i) + } { + ::IResult::Done(_, o) => ::IResult::Done(i, Some(o)), + ::IResult::Error(_) => ::IResult::Done(i, None), + _ => ::IResult::Incomplete(0, 0), + } + } { + ::IResult::Done(z, _) => ::IResult::Done(z, None::<String>), + _ => return () + }; + match Y { + ::IResult::Done(x, _) => { + let bytes = b"; "; + let len = x.len(); + bytes[len]; + } + _ => () + } + } +} diff --git a/tests/ui/issues/issue-47377.rs b/tests/ui/issues/issue-47377.rs new file mode 100644 index 000000000..7a2e0fe6d --- /dev/null +++ b/tests/ui/issues/issue-47377.rs @@ -0,0 +1,6 @@ +// ignore-tidy-tab +fn main() { + let b = "hello"; + let _a = b + ", World!"; + //~^ ERROR E0369 +} diff --git a/tests/ui/issues/issue-47377.stderr b/tests/ui/issues/issue-47377.stderr new file mode 100644 index 000000000..4f0fd948e --- /dev/null +++ b/tests/ui/issues/issue-47377.stderr @@ -0,0 +1,18 @@ +error[E0369]: cannot add `&str` to `&str` + --> $DIR/issue-47377.rs:4:14 + | +LL | let _a = b + ", World!"; + | - ^ ---------- &str + | | | + | | `+` cannot be used to concatenate two `&str` strings + | &str + | + = note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + | +LL | let _a = b.to_owned() + ", World!"; + | +++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-47380.rs b/tests/ui/issues/issue-47380.rs new file mode 100644 index 000000000..61e096622 --- /dev/null +++ b/tests/ui/issues/issue-47380.rs @@ -0,0 +1,5 @@ +fn main() { + let b = "hello"; + println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; + //~^ ERROR E0369 +} diff --git a/tests/ui/issues/issue-47380.stderr b/tests/ui/issues/issue-47380.stderr new file mode 100644 index 000000000..b04ac5536 --- /dev/null +++ b/tests/ui/issues/issue-47380.stderr @@ -0,0 +1,18 @@ +error[E0369]: cannot add `&str` to `&str` + --> $DIR/issue-47380.rs:3:35 + | +LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; + | - ^ ---------- &str + | | | + | | `+` cannot be used to concatenate two `&str` strings + | &str + | + = note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + | +LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!"; + | +++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-47486.rs b/tests/ui/issues/issue-47486.rs new file mode 100644 index 000000000..d686f02a9 --- /dev/null +++ b/tests/ui/issues/issue-47486.rs @@ -0,0 +1,4 @@ +fn main() { + () < std::mem::size_of::<_>(); //~ ERROR: mismatched types + [0u8; std::mem::size_of::<_>()]; //~ ERROR: type annotations needed +} diff --git a/tests/ui/issues/issue-47486.stderr b/tests/ui/issues/issue-47486.stderr new file mode 100644 index 000000000..c7e9af70e --- /dev/null +++ b/tests/ui/issues/issue-47486.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-47486.rs:2:10 + | +LL | () < std::mem::size_of::<_>(); + | -- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `usize` + | | + | expected because this is `()` + +error[E0282]: type annotations needed + --> $DIR/issue-47486.rs:3:11 + | +LL | [0u8; std::mem::size_of::<_>()]; + | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `size_of` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0282, E0308. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-4759-1.rs b/tests/ui/issues/issue-4759-1.rs new file mode 100644 index 000000000..96fae0fec --- /dev/null +++ b/tests/ui/issues/issue-4759-1.rs @@ -0,0 +1,4 @@ +// run-pass +trait U { fn f(self); } +impl U for isize { fn f(self) {} } +pub fn main() { 4.f(); } diff --git a/tests/ui/issues/issue-4759.rs b/tests/ui/issues/issue-4759.rs new file mode 100644 index 000000000..e5b9e2ed5 --- /dev/null +++ b/tests/ui/issues/issue-4759.rs @@ -0,0 +1,18 @@ +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_shorthand_field_patterns)] + +struct T { a: Box<isize> } + +trait U { + fn f(self); +} + +impl U for Box<isize> { + fn f(self) { } +} + +pub fn main() { + let T { a: a } = T { a: Box::new(0) }; + a.f(); +} diff --git a/tests/ui/issues/issue-47638.rs b/tests/ui/issues/issue-47638.rs new file mode 100644 index 000000000..a1ed3c365 --- /dev/null +++ b/tests/ui/issues/issue-47638.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(unused_variables)] +fn id<'c, 'b>(f: &'c &'b dyn Fn(&i32)) -> &'c &'b dyn Fn(&'static i32) { + f +} + +fn main() { + let f: &dyn Fn(&i32) = &|x| {}; + id(&f); +} diff --git a/tests/ui/issues/issue-47646.rs b/tests/ui/issues/issue-47646.rs new file mode 100644 index 000000000..ace6cdce8 --- /dev/null +++ b/tests/ui/issues/issue-47646.rs @@ -0,0 +1,13 @@ +use std::collections::BinaryHeap; + +fn main() { + let mut heap: BinaryHeap<i32> = BinaryHeap::new(); + let borrow = heap.peek_mut(); + + match (borrow, ()) { + (Some(_), ()) => { + println!("{:?}", heap); //~ ERROR cannot borrow `heap` as immutable + } + _ => {} + }; +} diff --git a/tests/ui/issues/issue-47646.stderr b/tests/ui/issues/issue-47646.stderr new file mode 100644 index 000000000..84cf9237a --- /dev/null +++ b/tests/ui/issues/issue-47646.stderr @@ -0,0 +1,20 @@ +error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as mutable + --> $DIR/issue-47646.rs:9:30 + | +LL | let borrow = heap.peek_mut(); + | --------------- mutable borrow occurs here +LL | +LL | match (borrow, ()) { + | ------------ a temporary with access to the mutable borrow is created here ... +LL | (Some(_), ()) => { +LL | println!("{:?}", heap); + | ^^^^ immutable borrow occurs here +... +LL | }; + | - ... and the mutable borrow might be used here, when that temporary is dropped and runs the destructor for type `(Option<PeekMut<'_, i32>>, ())` + | + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/issues/issue-47673.rs b/tests/ui/issues/issue-47673.rs new file mode 100644 index 000000000..b5f0febfb --- /dev/null +++ b/tests/ui/issues/issue-47673.rs @@ -0,0 +1,6 @@ +// check-pass +#![allow(unused_imports)] + +use {{}, {}}; + +fn main() {} diff --git a/tests/ui/issues/issue-47703-1.rs b/tests/ui/issues/issue-47703-1.rs new file mode 100644 index 000000000..61d684c2a --- /dev/null +++ b/tests/ui/issues/issue-47703-1.rs @@ -0,0 +1,23 @@ +// check-pass + +struct AtomicRefMut<'a> { + value: &'a mut i32, + borrow: AtomicBorrowRefMut, +} + +struct AtomicBorrowRefMut { +} + +impl Drop for AtomicBorrowRefMut { + fn drop(&mut self) { + } +} + +fn map(orig: AtomicRefMut) -> AtomicRefMut { + AtomicRefMut { + value: orig.value, + borrow: orig.borrow, + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-47703-tuple.rs b/tests/ui/issues/issue-47703-tuple.rs new file mode 100644 index 000000000..bad187ead --- /dev/null +++ b/tests/ui/issues/issue-47703-tuple.rs @@ -0,0 +1,11 @@ +// check-pass + +struct WithDrop; + +impl Drop for WithDrop { + fn drop(&mut self) {} +} + +fn consume(x: (&mut (), WithDrop)) -> &mut () { x.0 } + +fn main() {} diff --git a/tests/ui/issues/issue-47703.rs b/tests/ui/issues/issue-47703.rs new file mode 100644 index 000000000..38be6f5d2 --- /dev/null +++ b/tests/ui/issues/issue-47703.rs @@ -0,0 +1,18 @@ +// check-pass + +struct MyStruct<'a> { + field: &'a mut (), + field2: WithDrop +} + +struct WithDrop; + +impl Drop for WithDrop { + fn drop(&mut self) {} +} + +impl<'a> MyStruct<'a> { + fn consume(self) -> &'a mut () { self.field } +} + +fn main() {} diff --git a/tests/ui/issues/issue-47715.rs b/tests/ui/issues/issue-47715.rs new file mode 100644 index 000000000..b8088c18d --- /dev/null +++ b/tests/ui/issues/issue-47715.rs @@ -0,0 +1,28 @@ +trait Foo {} + +trait Bar<T> {} + +trait Iterable { + type Item; +} + +struct Container<T: Iterable<Item = impl Foo>> { + //~^ ERROR `impl Trait` only allowed in function and inherent method return types + field: T +} + +enum Enum<T: Iterable<Item = impl Foo>> { + //~^ ERROR `impl Trait` only allowed in function and inherent method return types + A(T), +} + +union Union<T: Iterable<Item = impl Foo> + Copy> { + //~^ ERROR `impl Trait` only allowed in function and inherent method return types + x: T, +} + +type Type<T: Iterable<Item = impl Foo>> = T; +//~^ ERROR `impl Trait` only allowed in function and inherent method return types + +fn main() { +} diff --git a/tests/ui/issues/issue-47715.stderr b/tests/ui/issues/issue-47715.stderr new file mode 100644 index 000000000..0ee9388bf --- /dev/null +++ b/tests/ui/issues/issue-47715.stderr @@ -0,0 +1,27 @@ +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic + --> $DIR/issue-47715.rs:9:37 + | +LL | struct Container<T: Iterable<Item = impl Foo>> { + | ^^^^^^^^ + +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic + --> $DIR/issue-47715.rs:14:30 + | +LL | enum Enum<T: Iterable<Item = impl Foo>> { + | ^^^^^^^^ + +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic + --> $DIR/issue-47715.rs:19:32 + | +LL | union Union<T: Iterable<Item = impl Foo> + Copy> { + | ^^^^^^^^ + +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic + --> $DIR/issue-47715.rs:24:30 + | +LL | type Type<T: Iterable<Item = impl Foo>> = T; + | ^^^^^^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/issues/issue-47722.rs b/tests/ui/issues/issue-47722.rs new file mode 100644 index 000000000..5645a6343 --- /dev/null +++ b/tests/ui/issues/issue-47722.rs @@ -0,0 +1,17 @@ +// check-pass + +// Tests that automatic coercions from &mut T to *mut T +// allow borrows of T to expire immediately - essentially, that +// they work identically to 'foo as *mut T' + +struct SelfReference { + self_reference: *mut SelfReference, +} + +impl SelfReference { + fn set_self_ref(&mut self) { + self.self_reference = self; + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-47725.rs b/tests/ui/issues/issue-47725.rs new file mode 100644 index 000000000..9ec55be58 --- /dev/null +++ b/tests/ui/issues/issue-47725.rs @@ -0,0 +1,28 @@ +#![warn(unused_attributes)] //~ NOTE lint level is defined here + +#[link_name = "foo"] +//~^ WARN attribute should be applied to a foreign function or static [unused_attributes] +//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +struct Foo; //~ NOTE not a foreign function or static + +#[link_name = "foobar"] +//~^ WARN attribute should be applied to a foreign function or static [unused_attributes] +//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +//~| HELP try `#[link(name = "foobar")]` instead +extern "C" { + fn foo() -> u32; +} +//~^^^ NOTE not a foreign function or static + +#[link_name] +//~^ ERROR malformed `link_name` attribute input +//~| HELP must be of the form +//~| WARN attribute should be applied to a foreign function or static [unused_attributes] +//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +//~| HELP try `#[link(name = "...")]` instead +extern "C" { + fn bar() -> u32; +} +//~^^^ NOTE not a foreign function or static + +fn main() {} diff --git a/tests/ui/issues/issue-47725.stderr b/tests/ui/issues/issue-47725.stderr new file mode 100644 index 000000000..7143fb4d6 --- /dev/null +++ b/tests/ui/issues/issue-47725.stderr @@ -0,0 +1,60 @@ +error: malformed `link_name` attribute input + --> $DIR/issue-47725.rs:17:1 + | +LL | #[link_name] + | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` + +warning: attribute should be applied to a foreign function or static + --> $DIR/issue-47725.rs:3:1 + | +LL | #[link_name = "foo"] + | ^^^^^^^^^^^^^^^^^^^^ +... +LL | struct Foo; + | ----------- not a foreign function or static + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +note: the lint level is defined here + --> $DIR/issue-47725.rs:1:9 + | +LL | #![warn(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +warning: attribute should be applied to a foreign function or static + --> $DIR/issue-47725.rs:8:1 + | +LL | #[link_name = "foobar"] + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | / extern "C" { +LL | | fn foo() -> u32; +LL | | } + | |_- not a foreign function or static + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: try `#[link(name = "foobar")]` instead + --> $DIR/issue-47725.rs:8:1 + | +LL | #[link_name = "foobar"] + | ^^^^^^^^^^^^^^^^^^^^^^^ + +warning: attribute should be applied to a foreign function or static + --> $DIR/issue-47725.rs:17:1 + | +LL | #[link_name] + | ^^^^^^^^^^^^ +... +LL | / extern "C" { +LL | | fn bar() -> u32; +LL | | } + | |_- not a foreign function or static + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +help: try `#[link(name = "...")]` instead + --> $DIR/issue-47725.rs:17:1 + | +LL | #[link_name] + | ^^^^^^^^^^^^ + +error: aborting due to previous error; 3 warnings emitted + diff --git a/tests/ui/issues/issue-48006.rs b/tests/ui/issues/issue-48006.rs new file mode 100644 index 000000000..cfef270e5 --- /dev/null +++ b/tests/ui/issues/issue-48006.rs @@ -0,0 +1,15 @@ +// run-pass + +#![feature(step_trait)] + +use std::iter::Step; + +#[cfg(target_pointer_width = "16")] +fn main() { + assert!(Step::steps_between(&0u32, &u32::MAX).is_none()); +} + +#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] +fn main() { + assert!(Step::steps_between(&0u32, &u32::MAX).is_some()); +} diff --git a/tests/ui/issues/issue-48131.mir.stderr b/tests/ui/issues/issue-48131.mir.stderr new file mode 100644 index 000000000..6817e8830 --- /dev/null +++ b/tests/ui/issues/issue-48131.mir.stderr @@ -0,0 +1,20 @@ +error: unnecessary `unsafe` block + --> $DIR/issue-48131.rs:12:9 + | +LL | unsafe { /* unnecessary */ } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/issue-48131.rs:6:9 + | +LL | #![deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/issue-48131.rs:23:13 + | +LL | unsafe { /* unnecessary */ } + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-48131.rs b/tests/ui/issues/issue-48131.rs new file mode 100644 index 000000000..df9854708 --- /dev/null +++ b/tests/ui/issues/issue-48131.rs @@ -0,0 +1,33 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +// This note is annotated because the purpose of the test +// is to ensure that certain other notes are not generated. +#![deny(unused_unsafe)] //~ NOTE + + +// (test that no note is generated on this unsafe fn) +pub unsafe fn a() { + fn inner() { + unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` + //~^ NOTE + } + + inner() +} + +pub fn b() { + // (test that no note is generated on this unsafe block) + unsafe { + fn inner() { + unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` + //~^ NOTE + } + // `()` is fine to zero-initialize as it is zero sized and inhabited. + let () = ::std::mem::zeroed(); + + inner() + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-48131.thir.stderr b/tests/ui/issues/issue-48131.thir.stderr new file mode 100644 index 000000000..6817e8830 --- /dev/null +++ b/tests/ui/issues/issue-48131.thir.stderr @@ -0,0 +1,20 @@ +error: unnecessary `unsafe` block + --> $DIR/issue-48131.rs:12:9 + | +LL | unsafe { /* unnecessary */ } + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/issue-48131.rs:6:9 + | +LL | #![deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: unnecessary `unsafe` block + --> $DIR/issue-48131.rs:23:13 + | +LL | unsafe { /* unnecessary */ } + | ^^^^^^ unnecessary `unsafe` block + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-48132.rs b/tests/ui/issues/issue-48132.rs new file mode 100644 index 000000000..f564aefe7 --- /dev/null +++ b/tests/ui/issues/issue-48132.rs @@ -0,0 +1,31 @@ +// Regression test for #48132. This was failing due to problems around +// the projection caching and dropck type enumeration. + +// run-pass + +#![allow(dead_code)] + +struct Inner<I, V> { + iterator: I, + item: V, +} + +struct Outer<I: Iterator> { + inner: Inner<I, I::Item>, +} + +fn outer<I>(iterator: I) -> Outer<I> +where I: Iterator, + I::Item: Default, +{ + Outer { + inner: Inner { + iterator: iterator, + item: Default::default(), + } + } +} + +fn main() { + outer(std::iter::once(&1).cloned()); +} diff --git a/tests/ui/issues/issue-48159.rs b/tests/ui/issues/issue-48159.rs new file mode 100644 index 000000000..fc8f31fb1 --- /dev/null +++ b/tests/ui/issues/issue-48159.rs @@ -0,0 +1,27 @@ +// run-pass +#![allow(non_camel_case_types)] + +use std::mem; + +pub enum c_void {} + +type uintptr_t = usize; +type int16_t = u16; +type uint16_t = int16_t; +type uint32_t = u32; +type intptr_t = uintptr_t; + +#[repr(C)] +#[repr(packed(4))] +pub struct kevent { + pub ident: uintptr_t, + pub filter: int16_t, + pub flags: uint16_t, + pub fflags: uint32_t, + pub data: intptr_t, + pub udata: *mut c_void, +} + +fn main() { + assert_eq!(mem::align_of::<kevent>(), 4); +} diff --git a/tests/ui/issues/issue-48179.rs b/tests/ui/issues/issue-48179.rs new file mode 100644 index 000000000..f81203dc4 --- /dev/null +++ b/tests/ui/issues/issue-48179.rs @@ -0,0 +1,38 @@ +// Regression test for #48132. This was failing due to problems around +// the projection caching and dropck type enumeration. + +// check-pass + +pub struct Container<T: Iterator> { + value: Option<T::Item>, +} + +impl<T: Iterator> Container<T> { + pub fn new(iter: T) -> Self { + panic!() + } +} + +pub struct Wrapper<'a> { + content: &'a Content, +} + +impl<'a, 'de> Wrapper<'a> { + pub fn new(content: &'a Content) -> Self { + Wrapper { + content: content, + } + } +} + +pub struct Content; + +fn crash_it(content: Content) { + let items = vec![content]; + let map = items.iter().map(|ref o| Wrapper::new(o)); + + let mut map_visitor = Container::new(map); + +} + +fn main() {} diff --git a/tests/ui/issues/issue-48276.rs b/tests/ui/issues/issue-48276.rs new file mode 100644 index 000000000..f55c056fa --- /dev/null +++ b/tests/ui/issues/issue-48276.rs @@ -0,0 +1,33 @@ +// Regression test for issue #48276 - ICE when self type does not match what is +// required by a trait and regions are involved. + +trait MyFrom<A> { + fn from(a: A) -> Self; +} + +struct A; + +impl<'a, 'b> MyFrom<A> for &'a str { + fn from(self: &'a Self) -> &'b str { + //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait + "asdf" + } +} + +struct B; + +impl From<A> for B { + fn from(&self) -> B { + //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait + B + } +} + +impl From<A> for &'static str { + fn from(&self) -> &'static str { + //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait + "" + } +} + +fn main(){} diff --git a/tests/ui/issues/issue-48276.stderr b/tests/ui/issues/issue-48276.stderr new file mode 100644 index 000000000..370905ee0 --- /dev/null +++ b/tests/ui/issues/issue-48276.stderr @@ -0,0 +1,28 @@ +error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait + --> $DIR/issue-48276.rs:11:5 + | +LL | fn from(a: A) -> Self; + | ---------------------- trait method declared without `&self` +... +LL | fn from(self: &'a Self) -> &'b str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl + +error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait + --> $DIR/issue-48276.rs:20:5 + | +LL | fn from(&self) -> B { + | ^^^^^^^^^^^^^^^^^^^ `&self` used in impl + | + = note: `from` from trait: `fn(T) -> Self` + +error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait + --> $DIR/issue-48276.rs:27:5 + | +LL | fn from(&self) -> &'static str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl + | + = note: `from` from trait: `fn(T) -> Self` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0185`. diff --git a/tests/ui/issues/issue-4830.rs b/tests/ui/issues/issue-4830.rs new file mode 100644 index 000000000..a8553bd6b --- /dev/null +++ b/tests/ui/issues/issue-4830.rs @@ -0,0 +1,11 @@ +// check-pass +#![allow(dead_code)] + +// pretty-expanded FIXME #23616 + +pub struct Scheduler { + /// The event loop used to drive the scheduler and perform I/O + event_loop: Box<isize> +} + +pub fn main() { } diff --git a/tests/ui/issues/issue-48364.rs b/tests/ui/issues/issue-48364.rs new file mode 100644 index 000000000..14ee75e7c --- /dev/null +++ b/tests/ui/issues/issue-48364.rs @@ -0,0 +1,6 @@ +fn foo() -> bool { + b"".starts_with(stringify!(foo)) + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/issues/issue-48364.stderr b/tests/ui/issues/issue-48364.stderr new file mode 100644 index 000000000..60bbfc0c6 --- /dev/null +++ b/tests/ui/issues/issue-48364.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/issue-48364.rs:2:21 + | +LL | b"".starts_with(stringify!(foo)) + | ----------- ^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str` + | | + | arguments to this method are incorrect + | + = note: expected reference `&[u8]` + found reference `&'static str` +note: associated function defined here + --> $SRC_DIR/core/src/slice/mod.rs:LL:COL + = note: this error originates in the macro `stringify` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-48728.rs b/tests/ui/issues/issue-48728.rs new file mode 100644 index 000000000..cbdc10bd2 --- /dev/null +++ b/tests/ui/issues/issue-48728.rs @@ -0,0 +1,13 @@ +// Regression test for #48728, an ICE that occurred computing +// coherence "help" information. + +#[derive(Clone)] //~ ERROR conflicting implementations of trait `Clone` +struct Node<T: ?Sized>(Box<T>); + +impl<T: Clone + ?Sized> Clone for Node<[T]> { + fn clone(&self) -> Self { + Node(Box::clone(&self.0)) + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-48728.stderr b/tests/ui/issues/issue-48728.stderr new file mode 100644 index 000000000..0bb46724f --- /dev/null +++ b/tests/ui/issues/issue-48728.stderr @@ -0,0 +1,15 @@ +error[E0119]: conflicting implementations of trait `Clone` for type `Node<[_]>` + --> $DIR/issue-48728.rs:4:10 + | +LL | #[derive(Clone)] + | ^^^^^ conflicting implementation for `Node<[_]>` +... +LL | impl<T: Clone + ?Sized> Clone for Node<[T]> { + | ------------------------------------------- first implementation here + | + = note: upstream crates may add a new impl of trait `std::clone::Clone` for type `[_]` in future versions + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/issues/issue-4875.rs b/tests/ui/issues/issue-4875.rs new file mode 100644 index 000000000..8d361314f --- /dev/null +++ b/tests/ui/issues/issue-4875.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] +// regression test for issue 4875 + +// pretty-expanded FIXME #23616 + +pub struct Foo<T> { + data: T, +} + +fn foo<T>(Foo{..}: Foo<T>) { +} + +pub fn main() { +} diff --git a/tests/ui/issues/issue-48838.rs b/tests/ui/issues/issue-48838.rs new file mode 100644 index 000000000..057a424df --- /dev/null +++ b/tests/ui/issues/issue-48838.rs @@ -0,0 +1,5 @@ +enum Functions { + Square = |x| x, //~ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/issues/issue-48838.stderr b/tests/ui/issues/issue-48838.stderr new file mode 100644 index 000000000..3502af702 --- /dev/null +++ b/tests/ui/issues/issue-48838.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-48838.rs:2:14 + | +LL | Square = |x| x, + | ^^^^^ expected `isize`, found closure + | + = note: expected type `isize` + found closure `[closure@$DIR/issue-48838.rs:2:14: 2:17]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-48984.rs b/tests/ui/issues/issue-48984.rs new file mode 100644 index 000000000..cb340f848 --- /dev/null +++ b/tests/ui/issues/issue-48984.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(dead_code)] +// aux-build:issue-48984-aux.rs +extern crate issue48984aux; +use issue48984aux::Bar; + +fn do_thing<T: Bar>() { } + +fn main() { } diff --git a/tests/ui/issues/issue-49298.rs b/tests/ui/issues/issue-49298.rs new file mode 100644 index 000000000..e3ffa8e7c --- /dev/null +++ b/tests/ui/issues/issue-49298.rs @@ -0,0 +1,42 @@ +// run-pass +#![feature(test)] +#![allow(unused_mut)] // under NLL we get warning about `x` below: rust-lang/rust#54499 + +// This test is bogus (i.e., should be check-fail) during the period +// where #54986 is implemented and #54987 is *not* implemented. For +// now: just ignore it +// +// ignore-test + +// This test is checking that the space allocated for `x.1` does not +// overlap with `y`. (The reason why such a thing happened at one +// point was because `x.0: Void` and thus the whole type of `x` was +// uninhabited, and so the compiler thought it was safe to use the +// space of `x.1` to hold `y`.) +// +// That's a fine thing to test when this code is accepted by the +// compiler, and this code is being transcribed accordingly into +// the ui test issue-21232-partial-init-and-use.rs + +extern crate test; + +enum Void {} + +fn main() { + let mut x: (Void, usize); + let mut y = 42; + x.1 = 13; + + // Make sure `y` stays on the stack. + test::black_box(&mut y); + + // Check that the write to `x.1` did not overwrite `y`. + // Note that this doesn't fail with optimizations enabled, + // because we can't keep `x.1` on the stack, like we can `y`, + // as we can't borrow partially initialized variables. + assert_eq!(y.to_string(), "42"); + + // Check that `(Void, usize)` has space for the `usize` field. + assert_eq!(std::mem::size_of::<(Void, usize)>(), + std::mem::size_of::<usize>()); +} diff --git a/tests/ui/issues/issue-4935.rs b/tests/ui/issues/issue-4935.rs new file mode 100644 index 000000000..c95020a0c --- /dev/null +++ b/tests/ui/issues/issue-4935.rs @@ -0,0 +1,6 @@ +// Regression test for issue #4935 + +fn foo(a: usize) {} +//~^ defined here +fn main() { foo(5, 6) } +//~^ ERROR function takes 1 argument but 2 arguments were supplied diff --git a/tests/ui/issues/issue-4935.stderr b/tests/ui/issues/issue-4935.stderr new file mode 100644 index 000000000..bb45fa083 --- /dev/null +++ b/tests/ui/issues/issue-4935.stderr @@ -0,0 +1,19 @@ +error[E0061]: this function takes 1 argument but 2 arguments were supplied + --> $DIR/issue-4935.rs:5:13 + | +LL | fn main() { foo(5, 6) } + | ^^^ - argument of type `{integer}` unexpected + | +note: function defined here + --> $DIR/issue-4935.rs:3:4 + | +LL | fn foo(a: usize) {} + | ^^^ -------- +help: remove the extra argument + | +LL | fn main() { foo(5) } + | ~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/issues/issue-49544.rs b/tests/ui/issues/issue-49544.rs new file mode 100644 index 000000000..ed356275f --- /dev/null +++ b/tests/ui/issues/issue-49544.rs @@ -0,0 +1,9 @@ +// aux-build:issue-49544.rs +// check-pass + +extern crate issue_49544; +use issue_49544::foo; + +fn main() { + let _ = foo(); +} diff --git a/tests/ui/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs b/tests/ui/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs new file mode 100644 index 000000000..f30d7e2ed --- /dev/null +++ b/tests/ui/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(unused_variables)] +#![deny(non_shorthand_field_patterns)] + +pub struct Value<A> { pub value: A } + +#[macro_export] +macro_rules! pat { + ($a:pat) => { + Value { value: $a } + }; +} + +fn main() { + let pat!(value) = Value { value: () }; +} diff --git a/tests/ui/issues/issue-49632.rs b/tests/ui/issues/issue-49632.rs new file mode 100644 index 000000000..155fd0d24 --- /dev/null +++ b/tests/ui/issues/issue-49632.rs @@ -0,0 +1,8 @@ +// run-pass +#![feature(stmt_expr_attributes)] + +pub fn main() { + let _x = #[inline(always)] || {}; + let _y = #[inline(never)] || {}; + let _z = #[inline] || {}; +} diff --git a/tests/ui/issues/issue-4968.rs b/tests/ui/issues/issue-4968.rs new file mode 100644 index 000000000..634bd698d --- /dev/null +++ b/tests/ui/issues/issue-4968.rs @@ -0,0 +1,10 @@ +// Regression test for issue #4968 + +const A: (isize,isize) = (4,2); +fn main() { + match 42 { A => () } + //~^ ERROR mismatched types + //~| expected type `{integer}` + //~| found tuple `(isize, isize)` + //~| expected integer, found tuple +} diff --git a/tests/ui/issues/issue-4968.stderr b/tests/ui/issues/issue-4968.stderr new file mode 100644 index 000000000..bbaca4ed2 --- /dev/null +++ b/tests/ui/issues/issue-4968.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/issue-4968.rs:5:16 + | +LL | const A: (isize,isize) = (4,2); + | ---------------------- constant defined here +LL | fn main() { +LL | match 42 { A => () } + | -- ^ + | | | + | | expected integer, found tuple + | | `A` is interpreted as a constant, not a new binding + | | help: introduce a new binding instead: `other_a` + | this expression has type `{integer}` + | + = note: expected type `{integer}` + found tuple `(isize, isize)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-4972.rs b/tests/ui/issues/issue-4972.rs new file mode 100644 index 000000000..3f1c6f855 --- /dev/null +++ b/tests/ui/issues/issue-4972.rs @@ -0,0 +1,17 @@ +#![feature(box_patterns)] + +trait MyTrait { + fn dummy(&self) {} +} + +pub enum TraitWrapper { + A(Box<dyn MyTrait + 'static>), +} + +fn get_tw_map(tw: &TraitWrapper) -> &dyn MyTrait { + match *tw { + TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-4972.stderr b/tests/ui/issues/issue-4972.stderr new file mode 100644 index 000000000..83daded7e --- /dev/null +++ b/tests/ui/issues/issue-4972.stderr @@ -0,0 +1,9 @@ +error[E0033]: type `Box<(dyn MyTrait + 'static)>` cannot be dereferenced + --> $DIR/issue-4972.rs:13:25 + | +LL | TraitWrapper::A(box ref map) => map, + | ^^^^^^^^^^^ type `Box<(dyn MyTrait + 'static)>` cannot be dereferenced + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0033`. diff --git a/tests/ui/issues/issue-49824.rs b/tests/ui/issues/issue-49824.rs new file mode 100644 index 000000000..bc1cd6856 --- /dev/null +++ b/tests/ui/issues/issue-49824.rs @@ -0,0 +1,9 @@ +fn main() { + let mut x = 0; + || { + || { + //~^ ERROR captured variable cannot escape `FnMut` closure body + let _y = &mut x; + } + }; +} diff --git a/tests/ui/issues/issue-49824.stderr b/tests/ui/issues/issue-49824.stderr new file mode 100644 index 000000000..14beadece --- /dev/null +++ b/tests/ui/issues/issue-49824.stderr @@ -0,0 +1,23 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-49824.rs:4:9 + | +LL | let mut x = 0; + | ----- variable defined here +LL | || { + | - inferred to be a `FnMut` closure +LL | / || { +LL | | +LL | | let _y = &mut x; + | | - variable captured here +LL | | } + | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body + | + = note: `FnMut` closures only have access to their captured variables while they are executing... + = note: ...therefore, they cannot allow references to captured variables to escape +help: consider adding 'move' keyword before the nested closure + | +LL | move || { + | ++++ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-49851/compiler-builtins-error.rs b/tests/ui/issues/issue-49851/compiler-builtins-error.rs new file mode 100644 index 000000000..4e56cca33 --- /dev/null +++ b/tests/ui/issues/issue-49851/compiler-builtins-error.rs @@ -0,0 +1,13 @@ +//~ ERROR can't find crate for `core` +//~^ ERROR can't find crate for `compiler_builtins` + +// compile-flags: --target thumbv7em-none-eabihf +// needs-llvm-components: arm +#![deny(unsafe_code)] +#![deny(warnings)] +#![no_std] + +extern crate cortex_m; +//~^ ERROR can't find crate for `cortex_m` + +fn main() {} diff --git a/tests/ui/issues/issue-49851/compiler-builtins-error.stderr b/tests/ui/issues/issue-49851/compiler-builtins-error.stderr new file mode 100644 index 000000000..fcfa2bf11 --- /dev/null +++ b/tests/ui/issues/issue-49851/compiler-builtins-error.stderr @@ -0,0 +1,19 @@ +error[E0463]: can't find crate for `core` + | + = note: the `thumbv7em-none-eabihf` target may not be installed + = help: consider downloading the target with `rustup target add thumbv7em-none-eabihf` + = help: consider building the standard library from source with `cargo build -Zbuild-std` + +error[E0463]: can't find crate for `compiler_builtins` + +error[E0463]: can't find crate for `cortex_m` + --> $DIR/compiler-builtins-error.rs:10:1 + | +LL | extern crate cortex_m; + | ^^^^^^^^^^^^^^^^^^^^^^ can't find crate + +error: requires `sized` lang_item + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0463`. diff --git a/tests/ui/issues/issue-49854.rs b/tests/ui/issues/issue-49854.rs new file mode 100644 index 000000000..0e1db00a3 --- /dev/null +++ b/tests/ui/issues/issue-49854.rs @@ -0,0 +1,9 @@ +// run-pass +use std::ffi::OsString; + +fn main() { + let os_str = OsString::from("Hello Rust!"); + + assert_eq!(os_str, "Hello Rust!"); + assert_eq!("Hello Rust!", os_str); +} diff --git a/tests/ui/issues/issue-49919.rs b/tests/ui/issues/issue-49919.rs new file mode 100644 index 000000000..780f33868 --- /dev/null +++ b/tests/ui/issues/issue-49919.rs @@ -0,0 +1,7 @@ +fn foo<'a, T: 'a>(t: T) -> Box<dyn Fn() -> &'a T + 'a> { + let foo: Box<dyn for <'c> Fn() -> &'c T> = Box::new(move || &t); + //~^ ERROR: binding for associated type + unimplemented!() +} + +fn main() {} diff --git a/tests/ui/issues/issue-49919.stderr b/tests/ui/issues/issue-49919.stderr new file mode 100644 index 000000000..8098be5cc --- /dev/null +++ b/tests/ui/issues/issue-49919.stderr @@ -0,0 +1,9 @@ +error[E0582]: binding for associated type `Output` references lifetime `'c`, which does not appear in the trait input types + --> $DIR/issue-49919.rs:2:39 + | +LL | let foo: Box<dyn for <'c> Fn() -> &'c T> = Box::new(move || &t); + | ^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0582`. diff --git a/tests/ui/issues/issue-49934-errors.rs b/tests/ui/issues/issue-49934-errors.rs new file mode 100644 index 000000000..dd14bac5e --- /dev/null +++ b/tests/ui/issues/issue-49934-errors.rs @@ -0,0 +1,8 @@ +fn foo<#[derive(Debug)] T>() { //~ ERROR expected non-macro attribute, found attribute macro + match 0 { + #[derive(Debug)] //~ ERROR expected non-macro attribute, found attribute macro + _ => (), + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-49934-errors.stderr b/tests/ui/issues/issue-49934-errors.stderr new file mode 100644 index 000000000..8c4c54170 --- /dev/null +++ b/tests/ui/issues/issue-49934-errors.stderr @@ -0,0 +1,14 @@ +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/issue-49934-errors.rs:1:10 + | +LL | fn foo<#[derive(Debug)] T>() { + | ^^^^^^ not a non-macro attribute + +error: expected non-macro attribute, found attribute macro `derive` + --> $DIR/issue-49934-errors.rs:3:11 + | +LL | #[derive(Debug)] + | ^^^^^^ not a non-macro attribute + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-49934.rs b/tests/ui/issues/issue-49934.rs new file mode 100644 index 000000000..119d84a06 --- /dev/null +++ b/tests/ui/issues/issue-49934.rs @@ -0,0 +1,30 @@ +#![feature(stmt_expr_attributes)] + +fn main() { + // fold_stmt (Item) + #[allow(dead_code)] + #[derive(Debug)] // should not warn + struct Foo; + + // fold_stmt (Mac) + #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s + println!("Hello, world!"); + + // fold_stmt (Semi) + #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s + "Hello, world!"; + + // fold_stmt (Local) + #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s + let _ = "Hello, world!"; + + // visit_expr + let _ = #[derive(Debug)] "Hello, world!"; + //~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s + + let _ = [ + // filter_map_expr + #[derive(Debug)] //~ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s + "Hello, world!", + ]; +} diff --git a/tests/ui/issues/issue-49934.stderr b/tests/ui/issues/issue-49934.stderr new file mode 100644 index 000000000..f2ff541bb --- /dev/null +++ b/tests/ui/issues/issue-49934.stderr @@ -0,0 +1,43 @@ +error[E0774]: `derive` may only be applied to `struct`s, `enum`s and `union`s + --> $DIR/issue-49934.rs:10:5 + | +LL | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ not applicable here +LL | println!("Hello, world!"); + | -------------------------- not a `struct`, `enum` or `union` + +error[E0774]: `derive` may only be applied to `struct`s, `enum`s and `union`s + --> $DIR/issue-49934.rs:14:5 + | +LL | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ not applicable here +LL | "Hello, world!"; + | ---------------- not a `struct`, `enum` or `union` + +error[E0774]: `derive` may only be applied to `struct`s, `enum`s and `union`s + --> $DIR/issue-49934.rs:18:5 + | +LL | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ not applicable here +LL | let _ = "Hello, world!"; + | ------------------------ not a `struct`, `enum` or `union` + +error[E0774]: `derive` may only be applied to `struct`s, `enum`s and `union`s + --> $DIR/issue-49934.rs:22:13 + | +LL | let _ = #[derive(Debug)] "Hello, world!"; + | ^^^^^^^^^^^^^^^^ --------------- not a `struct`, `enum` or `union` + | | + | not applicable here + +error[E0774]: `derive` may only be applied to `struct`s, `enum`s and `union`s + --> $DIR/issue-49934.rs:27:9 + | +LL | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ not applicable here +LL | "Hello, world!", + | --------------- not a `struct`, `enum` or `union` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0774`. diff --git a/tests/ui/issues/issue-49955.rs b/tests/ui/issues/issue-49955.rs new file mode 100644 index 000000000..f2f3ebff2 --- /dev/null +++ b/tests/ui/issues/issue-49955.rs @@ -0,0 +1,20 @@ +// run-pass + +const ALL_THE_NUMS: [u32; 1] = [ + 1 +]; + +#[inline(never)] +fn array(i: usize) -> &'static u32 { + return &ALL_THE_NUMS[i]; +} + +#[inline(never)] +fn tuple_field() -> &'static u32 { + &(42,).0 +} + +fn main() { + assert_eq!(tuple_field().to_string(), "42"); + assert_eq!(array(0).to_string(), "1"); +} diff --git a/tests/ui/issues/issue-49973.rs b/tests/ui/issues/issue-49973.rs new file mode 100644 index 000000000..af421c52f --- /dev/null +++ b/tests/ui/issues/issue-49973.rs @@ -0,0 +1,11 @@ +// run-pass +#[derive(Debug)] +#[repr(i32)] +enum E { + Min = -2147483648i32, + _Max = 2147483647i32, +} + +fn main() { + assert_eq!(Some(E::Min).unwrap() as i32, -2147483648i32); +} diff --git a/tests/ui/issues/issue-5008-borrowed-traitobject-method-call.rs b/tests/ui/issues/issue-5008-borrowed-traitobject-method-call.rs new file mode 100644 index 000000000..fc869ae4f --- /dev/null +++ b/tests/ui/issues/issue-5008-borrowed-traitobject-method-call.rs @@ -0,0 +1,34 @@ +// run-pass +/* + +#5008 cast to &Trait causes code to segfault on method call + +It fixes itself if the &Trait is changed to @Trait. +*/ + +trait Debuggable { + fn debug_name(&self) -> String; +} + +#[derive(Clone)] +struct Thing { + name: String, +} + +impl Thing { + fn new() -> Thing { Thing { name: "dummy".to_string() } } +} + +impl Debuggable for Thing { + fn debug_name(&self) -> String { self.name.clone() } +} + +fn print_name(x: &dyn Debuggable) +{ + println!("debug_name = {}", x.debug_name()); +} + +pub fn main() { + let thing = Thing::new(); + print_name(&thing as &dyn Debuggable); +} diff --git a/tests/ui/issues/issue-50187.rs b/tests/ui/issues/issue-50187.rs new file mode 100644 index 000000000..4b0aeaab4 --- /dev/null +++ b/tests/ui/issues/issue-50187.rs @@ -0,0 +1,39 @@ +// check-pass + +#![feature(decl_macro)] + +mod type_ns { + pub type A = u8; +} +mod value_ns { + pub const A: u8 = 0; +} +mod macro_ns { + pub macro A() {} +} + +mod merge2 { + pub use type_ns::A; + pub use value_ns::A; +} +mod merge3 { + pub use type_ns::A; + pub use value_ns::A; + pub use macro_ns::A; +} + +mod use2 { + pub use merge2::A; +} +mod use3 { + pub use merge3::A; +} + +fn main() { + type B2 = use2::A; + let a2 = use2::A; + + type B3 = use3::A; + let a3 = use3::A; + use3::A!(); +} diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs new file mode 100644 index 000000000..160cfc3d4 --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref.rs @@ -0,0 +1,4 @@ +fn main() { + let _result = &Some(42).as_deref(); +//~^ ERROR the method +} diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr new file mode 100644 index 000000000..ce8173169 --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr @@ -0,0 +1,12 @@ +error[E0599]: the method `as_deref` exists for enum `Option<{integer}>`, but its trait bounds were not satisfied + --> $DIR/option-as_deref.rs:2:29 + | +LL | let _result = &Some(42).as_deref(); + | ^^^^^^^^ + | + = note: the following trait bounds were not satisfied: + `{integer}: Deref` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.rs b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.rs new file mode 100644 index 000000000..ff5095ce3 --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.rs @@ -0,0 +1,4 @@ +fn main() { + let _result = &mut Some(42).as_deref_mut(); +//~^ ERROR the method +} diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr new file mode 100644 index 000000000..943f77486 --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr @@ -0,0 +1,12 @@ +error[E0599]: the method `as_deref_mut` exists for enum `Option<{integer}>`, but its trait bounds were not satisfied + --> $DIR/option-as_deref_mut.rs:2:33 + | +LL | let _result = &mut Some(42).as_deref_mut(); + | ^^^^^^^^^^^^ + | + = note: the following trait bounds were not satisfied: + `{integer}: Deref` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs new file mode 100644 index 000000000..4232f14d2 --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref.rs @@ -0,0 +1,4 @@ +fn main() { + let _result = &Ok(42).as_deref(); +//~^ ERROR the method +} diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr new file mode 100644 index 000000000..a3b9ac677 --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr @@ -0,0 +1,12 @@ +error[E0599]: the method `as_deref` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied + --> $DIR/result-as_deref.rs:2:27 + | +LL | let _result = &Ok(42).as_deref(); + | ^^^^^^^^ + | + = note: the following trait bounds were not satisfied: + `{integer}: Deref` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs new file mode 100644 index 000000000..3507d1d8e --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.rs @@ -0,0 +1,4 @@ +fn main() { + let _result = &mut Ok(42).as_deref_mut(); +//~^ ERROR the method +} diff --git a/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr new file mode 100644 index 000000000..aa771e4c0 --- /dev/null +++ b/tests/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr @@ -0,0 +1,12 @@ +error[E0599]: the method `as_deref_mut` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied + --> $DIR/result-as_deref_mut.rs:2:31 + | +LL | let _result = &mut Ok(42).as_deref_mut(); + | ^^^^^^^^^^^^ + | + = note: the following trait bounds were not satisfied: + `{integer}: Deref` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-50403.rs b/tests/ui/issues/issue-50403.rs new file mode 100644 index 000000000..012057fc2 --- /dev/null +++ b/tests/ui/issues/issue-50403.rs @@ -0,0 +1,5 @@ +#![feature(concat_idents)] + +fn main() { + let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments +} diff --git a/tests/ui/issues/issue-50403.stderr b/tests/ui/issues/issue-50403.stderr new file mode 100644 index 000000000..a3a2ed044 --- /dev/null +++ b/tests/ui/issues/issue-50403.stderr @@ -0,0 +1,8 @@ +error: concat_idents! takes 1 or more arguments + --> $DIR/issue-50403.rs:4:13 + | +LL | let x = concat_idents!(); + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-50411.rs b/tests/ui/issues/issue-50411.rs new file mode 100644 index 000000000..cd728b152 --- /dev/null +++ b/tests/ui/issues/issue-50411.rs @@ -0,0 +1,11 @@ +// Regression test for #50411: the MIR inliner was causing problems +// here because it would inline promoted code (which had already had +// elaborate-drops invoked on it) and then try to elaboate drops a +// second time. Uncool. + +// compile-flags:-Zmir-opt-level=4 +// build-pass + +fn main() { + let _ = (0 .. 1).filter(|_| [1].iter().all(|_| true)).count(); +} diff --git a/tests/ui/issues/issue-50415.rs b/tests/ui/issues/issue-50415.rs new file mode 100644 index 000000000..151b9fe44 --- /dev/null +++ b/tests/ui/issues/issue-50415.rs @@ -0,0 +1,16 @@ +// run-pass +fn main() { + // Simplified test case + let _ = || 0..=1; + + // Original test case + let full_length = 1024; + let range = { + // do some stuff, omit here + None + }; + + let range = range.map(|(s, t)| s..=t).unwrap_or(0..=(full_length-1)); + + assert_eq!(range, 0..=1023); +} diff --git a/tests/ui/issues/issue-50442.rs b/tests/ui/issues/issue-50442.rs new file mode 100644 index 000000000..25c7dde7a --- /dev/null +++ b/tests/ui/issues/issue-50442.rs @@ -0,0 +1,13 @@ +// run-pass +#![allow(dead_code)] +enum Void {} + +enum Foo { + A(i32), + B(Void), + C(i32) +} + +fn main() { + let _foo = Foo::A(0); +} diff --git a/tests/ui/issues/issue-50471.rs b/tests/ui/issues/issue-50471.rs new file mode 100644 index 000000000..7278c392d --- /dev/null +++ b/tests/ui/issues/issue-50471.rs @@ -0,0 +1,9 @@ +// check-pass + +fn main() { + assert!({false}); + + assert!(r"\u{41}" == "A"); + + assert!(r"\u{".is_empty()); +} diff --git a/tests/ui/issues/issue-50518.rs b/tests/ui/issues/issue-50518.rs new file mode 100644 index 000000000..1e7b77949 --- /dev/null +++ b/tests/ui/issues/issue-50518.rs @@ -0,0 +1,40 @@ +// check-pass +use std::marker::PhantomData; + +struct Meta<A> { + value: i32, + type_: PhantomData<A> +} + +trait MetaTrait { + fn get_value(&self) -> i32; +} + +impl<A> MetaTrait for Meta<A> { + fn get_value(&self) -> i32 { self.value } +} + +trait Bar { + fn get_const(&self) -> &dyn MetaTrait; +} + +struct Foo<A> { + _value: A +} + +impl<A: 'static> Foo<A> { + const CONST: &'static dyn MetaTrait = &Meta::<Self> { + value: 10, + type_: PhantomData + }; +} + +impl<A: 'static> Bar for Foo<A> { + fn get_const(&self) -> &dyn MetaTrait { Self::CONST } +} + +fn main() { + let foo = Foo::<i32> { _value: 10 }; + let bar: &dyn Bar = &foo; + println!("const {}", bar.get_const().get_value()); +} diff --git a/tests/ui/issues/issue-50571.fixed b/tests/ui/issues/issue-50571.fixed new file mode 100644 index 000000000..2f8c925b8 --- /dev/null +++ b/tests/ui/issues/issue-50571.fixed @@ -0,0 +1,8 @@ +// run-rustfix + +trait Foo { + fn foo(_: [i32; 2]) {} + //~^ ERROR: patterns aren't allowed in methods without bodies +} + +fn main() {} diff --git a/tests/ui/issues/issue-50571.rs b/tests/ui/issues/issue-50571.rs new file mode 100644 index 000000000..56f422e7d --- /dev/null +++ b/tests/ui/issues/issue-50571.rs @@ -0,0 +1,8 @@ +// run-rustfix + +trait Foo { + fn foo([a, b]: [i32; 2]) {} + //~^ ERROR: patterns aren't allowed in methods without bodies +} + +fn main() {} diff --git a/tests/ui/issues/issue-50571.stderr b/tests/ui/issues/issue-50571.stderr new file mode 100644 index 000000000..f69963bb7 --- /dev/null +++ b/tests/ui/issues/issue-50571.stderr @@ -0,0 +1,14 @@ +error[E0642]: patterns aren't allowed in methods without bodies + --> $DIR/issue-50571.rs:4:12 + | +LL | fn foo([a, b]: [i32; 2]) {} + | ^^^^^^ + | +help: give this argument a name or use an underscore to ignore it + | +LL | fn foo(_: [i32; 2]) {} + | ~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0642`. diff --git a/tests/ui/issues/issue-50576.rs b/tests/ui/issues/issue-50576.rs new file mode 100644 index 000000000..e0c36b827 --- /dev/null +++ b/tests/ui/issues/issue-50576.rs @@ -0,0 +1,6 @@ +fn main() { + |bool: [u8; break 'L]| 0; + //~^ ERROR [E0426] + //~| ERROR [E0268] + Vec::<[u8; break]>::new(); //~ ERROR [E0268] +} diff --git a/tests/ui/issues/issue-50576.stderr b/tests/ui/issues/issue-50576.stderr new file mode 100644 index 000000000..4ec22fde9 --- /dev/null +++ b/tests/ui/issues/issue-50576.stderr @@ -0,0 +1,22 @@ +error[E0426]: use of undeclared label `'L` + --> $DIR/issue-50576.rs:2:23 + | +LL | |bool: [u8; break 'L]| 0; + | ^^ undeclared label `'L` + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-50576.rs:2:17 + | +LL | |bool: [u8; break 'L]| 0; + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-50576.rs:5:16 + | +LL | Vec::<[u8; break]>::new(); + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0268, E0426. +For more information about an error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-50581.rs b/tests/ui/issues/issue-50581.rs new file mode 100644 index 000000000..12bb9930e --- /dev/null +++ b/tests/ui/issues/issue-50581.rs @@ -0,0 +1,3 @@ +fn main() { + |_: [u8; break]| (); //~ ERROR [E0268] +} diff --git a/tests/ui/issues/issue-50581.stderr b/tests/ui/issues/issue-50581.stderr new file mode 100644 index 000000000..07b6df072 --- /dev/null +++ b/tests/ui/issues/issue-50581.stderr @@ -0,0 +1,9 @@ +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-50581.rs:2:14 + | +LL | |_: [u8; break]| (); + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-50582.rs b/tests/ui/issues/issue-50582.rs new file mode 100644 index 000000000..2d5c93587 --- /dev/null +++ b/tests/ui/issues/issue-50582.rs @@ -0,0 +1,5 @@ +fn main() { + Vec::<[(); 1 + for x in 0..1 {}]>::new(); + //~^ ERROR cannot add + //~| ERROR `for` is not allowed in a `const` +} diff --git a/tests/ui/issues/issue-50582.stderr b/tests/ui/issues/issue-50582.stderr new file mode 100644 index 000000000..53ecc6112 --- /dev/null +++ b/tests/ui/issues/issue-50582.stderr @@ -0,0 +1,31 @@ +error[E0658]: `for` is not allowed in a `const` + --> $DIR/issue-50582.rs:2:20 + | +LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information + = help: add `#![feature(const_for)]` to the crate attributes to enable + +error[E0277]: cannot add `()` to `{integer}` in const contexts + --> $DIR/issue-50582.rs:2:18 + | +LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); + | ^ no implementation for `{integer} + ()` + | + = help: the trait `~const Add<()>` is not implemented for `{integer}` + = help: the following other types implement trait `Add<Rhs>`: + <&'a f32 as Add<f32>> + <&'a f64 as Add<f64>> + <&'a i128 as Add<i128>> + <&'a i16 as Add<i16>> + <&'a i32 as Add<i32>> + <&'a i64 as Add<i64>> + <&'a i8 as Add<i8>> + <&'a isize as Add<isize>> + and 48 others + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0658. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-50585.rs b/tests/ui/issues/issue-50585.rs new file mode 100644 index 000000000..a2f11c98d --- /dev/null +++ b/tests/ui/issues/issue-50585.rs @@ -0,0 +1,5 @@ +fn main() { + |y: Vec<[(); for x in 0..2 {}]>| {}; + //~^ ERROR mismatched types + //~| ERROR `for` is not allowed in a `const` +} diff --git a/tests/ui/issues/issue-50585.stderr b/tests/ui/issues/issue-50585.stderr new file mode 100644 index 000000000..e43cc20cb --- /dev/null +++ b/tests/ui/issues/issue-50585.stderr @@ -0,0 +1,19 @@ +error[E0658]: `for` is not allowed in a `const` + --> $DIR/issue-50585.rs:2:18 + | +LL | |y: Vec<[(); for x in 0..2 {}]>| {}; + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information + = help: add `#![feature(const_for)]` to the crate attributes to enable + +error[E0308]: mismatched types + --> $DIR/issue-50585.rs:2:18 + | +LL | |y: Vec<[(); for x in 0..2 {}]>| {}; + | ^^^^^^^^^^^^^^^^ expected `usize`, found `()` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-50600.rs b/tests/ui/issues/issue-50600.rs new file mode 100644 index 000000000..963e607af --- /dev/null +++ b/tests/ui/issues/issue-50600.rs @@ -0,0 +1,5 @@ +struct Foo ( + fn([u8; |x: u8| {}]), //~ ERROR mismatched types +); + +fn main() {} diff --git a/tests/ui/issues/issue-50600.stderr b/tests/ui/issues/issue-50600.stderr new file mode 100644 index 000000000..7fea7e5c0 --- /dev/null +++ b/tests/ui/issues/issue-50600.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-50600.rs:2:13 + | +LL | fn([u8; |x: u8| {}]), + | ^^^^^^^^^^ expected `usize`, found closure + | + = note: expected type `usize` + found closure `[closure@$DIR/issue-50600.rs:2:13: 2:20]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-50618.rs b/tests/ui/issues/issue-50618.rs new file mode 100644 index 000000000..5f762bc43 --- /dev/null +++ b/tests/ui/issues/issue-50618.rs @@ -0,0 +1,19 @@ +struct Point { + pub x: u64, + pub y: u64, +} + +const TEMPLATE: Point = Point { + x: 0, + y: 0 +}; + +fn main() { + let _ = || { + Point { + nonexistent: 0, + //~^ ERROR struct `Point` has no field named `nonexistent` + ..TEMPLATE + } + }; +} diff --git a/tests/ui/issues/issue-50618.stderr b/tests/ui/issues/issue-50618.stderr new file mode 100644 index 000000000..1ac5dde66 --- /dev/null +++ b/tests/ui/issues/issue-50618.stderr @@ -0,0 +1,11 @@ +error[E0560]: struct `Point` has no field named `nonexistent` + --> $DIR/issue-50618.rs:14:13 + | +LL | nonexistent: 0, + | ^^^^^^^^^^^ `Point` does not have this field + | + = note: available fields are: `x`, `y` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0560`. diff --git a/tests/ui/issues/issue-5062.rs b/tests/ui/issues/issue-5062.rs new file mode 100644 index 000000000..2db0a8e25 --- /dev/null +++ b/tests/ui/issues/issue-5062.rs @@ -0,0 +1,2 @@ +fn main() { format!("{:?}", None); } + //~^ ERROR type annotations needed [E0282] diff --git a/tests/ui/issues/issue-5062.stderr b/tests/ui/issues/issue-5062.stderr new file mode 100644 index 000000000..3191bd3de --- /dev/null +++ b/tests/ui/issues/issue-5062.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-5062.rs:1:29 + | +LL | fn main() { format!("{:?}", None); } + | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` + | +help: consider specifying the generic argument + | +LL | fn main() { format!("{:?}", None::<T>); } + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-5067.rs b/tests/ui/issues/issue-5067.rs new file mode 100644 index 000000000..5857a0815 --- /dev/null +++ b/tests/ui/issues/issue-5067.rs @@ -0,0 +1,75 @@ +#![allow(unused_macros)] + +// Tests that repetition matchers cannot match the empty token tree (since that would be +// ambiguous). + +// edition:2018 + +macro_rules! foo { + ( $()* ) => {}; + //~^ ERROR repetition matches empty token tree + ( $()+ ) => {}; + //~^ ERROR repetition matches empty token tree + ( $()? ) => {}; + //~^ ERROR repetition matches empty token tree + ( $(),* ) => {}; // PASS + ( $(),+ ) => {}; // PASS + // `?` cannot have a separator... + ( [$()*] ) => {}; + //~^ ERROR repetition matches empty token tree + ( [$()+] ) => {}; + //~^ ERROR repetition matches empty token tree + ( [$()?] ) => {}; + //~^ ERROR repetition matches empty token tree + ( [$(),*] ) => {}; // PASS + ( [$(),+] ) => {}; // PASS + // `?` cannot have a separator... + ( $($()* $(),* $(a)* $(a),* )* ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()* $(),* $(a)* $(a),* )+ ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()* $(),* $(a)* $(a),* )? ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()? $(),* $(a)? $(a),* )* ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()? $(),* $(a)? $(a),* )+ ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()? $(),* $(a)? $(a),* )? ) => {}; + //~^ ERROR repetition matches empty token tree + ( $(a $(),* $(a)* $(a),* )* ) => {}; // PASS + ( $($(a)+ $(),* $(a)* $(a),* )+ ) => {}; // PASS + ( $($(a)+ $(),* $(a)* $(a),* )? ) => {}; // PASS + + ( $(a $(),* $(a)? $(a),* )* ) => {}; // PASS + ( $($(a)+ $(),* $(a)? $(a),* )+ ) => {}; // PASS + ( $($(a)+ $(),* $(a)? $(a),* )? ) => {}; // PASS + + ( $(a $()+)* ) => {}; + //~^ ERROR repetition matches empty token tree + ( $(a $()*)+ ) => {}; + //~^ ERROR repetition matches empty token tree + ( $(a $()+)? ) => {}; + //~^ ERROR repetition matches empty token tree + ( $(a $()?)+ ) => {}; + //~^ ERROR repetition matches empty token tree +} + +// Original Issue + +macro_rules! make_vec { + (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]); + //~^ ERROR repetition matches empty token tree +} + +fn main() { + let _ = make_vec![a 1, a 2, a 3]; +} + +// Minified Issue + +macro_rules! m { + ( $()* ) => {}; + //~^ ERROR repetition matches empty token tree +} + +m!(); diff --git a/tests/ui/issues/issue-5067.stderr b/tests/ui/issues/issue-5067.stderr new file mode 100644 index 000000000..7ffc60714 --- /dev/null +++ b/tests/ui/issues/issue-5067.stderr @@ -0,0 +1,110 @@ +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:9:8 + | +LL | ( $()* ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:11:8 + | +LL | ( $()+ ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:13:8 + | +LL | ( $()? ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:18:9 + | +LL | ( [$()*] ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:20:9 + | +LL | ( [$()+] ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:22:9 + | +LL | ( [$()?] ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:27:8 + | +LL | ( $($()* $(),* $(a)* $(a),* )* ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:29:8 + | +LL | ( $($()* $(),* $(a)* $(a),* )+ ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:31:8 + | +LL | ( $($()* $(),* $(a)* $(a),* )? ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:33:8 + | +LL | ( $($()? $(),* $(a)? $(a),* )* ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:35:8 + | +LL | ( $($()? $(),* $(a)? $(a),* )+ ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:37:8 + | +LL | ( $($()? $(),* $(a)? $(a),* )? ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:47:12 + | +LL | ( $(a $()+)* ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:49:12 + | +LL | ( $(a $()*)+ ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:51:12 + | +LL | ( $(a $()+)? ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:53:12 + | +LL | ( $(a $()?)+ ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:60:18 + | +LL | (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]); + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:71:8 + | +LL | ( $()* ) => {}; + | ^^ + +error: aborting due to 18 previous errors + diff --git a/tests/ui/issues/issue-50688.rs b/tests/ui/issues/issue-50688.rs new file mode 100644 index 000000000..88f898b86 --- /dev/null +++ b/tests/ui/issues/issue-50688.rs @@ -0,0 +1,3 @@ +fn main() { + [1; || {}]; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-50688.stderr b/tests/ui/issues/issue-50688.stderr new file mode 100644 index 000000000..6973ad271 --- /dev/null +++ b/tests/ui/issues/issue-50688.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-50688.rs:2:9 + | +LL | [1; || {}]; + | ^^^^^ expected `usize`, found closure + | + = note: expected type `usize` + found closure `[closure@$DIR/issue-50688.rs:2:9: 2:11]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-50689.rs b/tests/ui/issues/issue-50689.rs new file mode 100644 index 000000000..b49f29500 --- /dev/null +++ b/tests/ui/issues/issue-50689.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(unused_variables)] +enum Foo { + Bar = (|x: i32| { }, 42).1, +} + +fn main() { + assert_eq!(Foo::Bar as usize, 42); +} diff --git a/tests/ui/issues/issue-50714-1.rs b/tests/ui/issues/issue-50714-1.rs new file mode 100644 index 000000000..a25940ce1 --- /dev/null +++ b/tests/ui/issues/issue-50714-1.rs @@ -0,0 +1,11 @@ +// Regression test for issue 50714, make sure that this isn't a linker error. + +#![no_std] +#![feature(start)] + +extern crate std; + +#[start] +fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { //~ ERROR [E0647] + 0 +} diff --git a/tests/ui/issues/issue-50714-1.stderr b/tests/ui/issues/issue-50714-1.stderr new file mode 100644 index 000000000..28469bee0 --- /dev/null +++ b/tests/ui/issues/issue-50714-1.stderr @@ -0,0 +1,9 @@ +error[E0647]: start function is not allowed to have a `where` clause + --> $DIR/issue-50714-1.rs:9:50 + | +LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { + | ^^^^^^^^^^^^^^^^^ start function cannot have a `where` clause + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0647`. diff --git a/tests/ui/issues/issue-50714.rs b/tests/ui/issues/issue-50714.rs new file mode 100644 index 000000000..c571a470c --- /dev/null +++ b/tests/ui/issues/issue-50714.rs @@ -0,0 +1,3 @@ +// Regression test for issue 50714, make sure that this isn't a linker error. + +fn main() where fn(&()): Eq {} //~ ERROR [E0646] diff --git a/tests/ui/issues/issue-50714.stderr b/tests/ui/issues/issue-50714.stderr new file mode 100644 index 000000000..a11aceb62 --- /dev/null +++ b/tests/ui/issues/issue-50714.stderr @@ -0,0 +1,9 @@ +error[E0646]: `main` function is not allowed to have a `where` clause + --> $DIR/issue-50714.rs:3:11 + | +LL | fn main() where fn(&()): Eq {} + | ^^^^^^^^^^^^^^^^^ `main` cannot have a `where` clause + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0646`. diff --git a/tests/ui/issues/issue-50761.rs b/tests/ui/issues/issue-50761.rs new file mode 100644 index 000000000..1bf494ba8 --- /dev/null +++ b/tests/ui/issues/issue-50761.rs @@ -0,0 +1,23 @@ +// Confirm that we don't accidentally divide or mod by zero in llvm_type + +// build-pass + +mod a { + pub trait A {} +} + +mod b { + pub struct Builder {} + + pub fn new() -> Builder { + Builder {} + } + + impl Builder { + pub fn with_a(&mut self, _a: fn() -> dyn (::a::A)) {} + } +} + +pub use self::b::new; + +fn main() {} diff --git a/tests/ui/issues/issue-50781.rs b/tests/ui/issues/issue-50781.rs new file mode 100644 index 000000000..3c5e5a9f6 --- /dev/null +++ b/tests/ui/issues/issue-50781.rs @@ -0,0 +1,19 @@ +#![deny(where_clauses_object_safety)] + +trait Trait {} + +trait X { + fn foo(&self) where Self: Trait; //~ ERROR the trait `X` cannot be made into an object + //~^ WARN this was previously accepted by the compiler but is being phased out +} + +impl X for () { + fn foo(&self) {} +} + +impl Trait for dyn X {} + +pub fn main() { + // Check that this does not segfault. + <dyn X as X>::foo(&()); +} diff --git a/tests/ui/issues/issue-50781.stderr b/tests/ui/issues/issue-50781.stderr new file mode 100644 index 000000000..e185ecdda --- /dev/null +++ b/tests/ui/issues/issue-50781.stderr @@ -0,0 +1,24 @@ +error: the trait `X` cannot be made into an object + --> $DIR/issue-50781.rs:6:8 + | +LL | fn foo(&self) where Self: Trait; + | ^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #51443 <https://github.com/rust-lang/rust/issues/51443> +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-50781.rs:6:8 + | +LL | trait X { + | - this trait cannot be made into an object... +LL | fn foo(&self) where Self: Trait; + | ^^^ ...because method `foo` references the `Self` type in its `where` clause + = help: consider moving `foo` to another trait +note: the lint level is defined here + --> $DIR/issue-50781.rs:1:9 + | +LL | #![deny(where_clauses_object_safety)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-50802.rs b/tests/ui/issues/issue-50802.rs new file mode 100644 index 000000000..dece55968 --- /dev/null +++ b/tests/ui/issues/issue-50802.rs @@ -0,0 +1,8 @@ +#[allow(unreachable_code)] + +fn main() { + loop { + break while continue { //~ ERROR E0590 + } + } +} diff --git a/tests/ui/issues/issue-50802.stderr b/tests/ui/issues/issue-50802.stderr new file mode 100644 index 000000000..e064fabcc --- /dev/null +++ b/tests/ui/issues/issue-50802.stderr @@ -0,0 +1,9 @@ +error[E0590]: `break` or `continue` with no label in the condition of a `while` loop + --> $DIR/issue-50802.rs:5:21 + | +LL | break while continue { + | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0590`. diff --git a/tests/ui/issues/issue-50811.rs b/tests/ui/issues/issue-50811.rs new file mode 100644 index 000000000..683c85604 --- /dev/null +++ b/tests/ui/issues/issue-50811.rs @@ -0,0 +1,55 @@ +// run-pass +#![feature(test)] + +extern crate test; + +use std::mem::size_of; +use test::black_box; + +// Ensure the const-eval result and runtime result of float comparison are equivalent. + +macro_rules! compare { + ($op:tt) => { + compare!( + [f64::NEG_INFINITY, -f64::MAX, -1.0, -0.0, 0.0, 1.0, f64::MAX, f64::INFINITY, f64::NAN], + $op + ); + }; + ([$($lhs:expr),+], $op:tt) => { + $(compare!( + $lhs, + $op, + [f64::NEG_INFINITY, -f64::MAX, -1.0, -0.0, 0.0, 1.0, f64::MAX, f64::INFINITY, f64::NAN] + );)+ + }; + ($lhs:expr, $op:tt, [$($rhs:expr),+]) => { + $({ + // Wrap the check in its own function to reduce time needed to borrowck. + fn check() { + static CONST_EVAL: bool = $lhs $op $rhs; + let runtime_eval = black_box($lhs) $op black_box($rhs); + assert_eq!(CONST_EVAL, runtime_eval, stringify!($lhs $op $rhs)); + assert_eq!( + size_of::<[u8; ($lhs $op $rhs) as usize]>(), + runtime_eval as usize, + stringify!($lhs $op $rhs (forced const eval)) + ); + } + check(); + })+ + }; +} + +fn main() { + assert_eq!(0.0/0.0 < 0.0/0.0, false); + assert_eq!(0.0/0.0 > 0.0/0.0, false); + assert_eq!(f64::NAN < f64::NAN, false); + assert_eq!(f64::NAN > f64::NAN, false); + + compare!(==); + compare!(!=); + compare!(<); + compare!(<=); + compare!(>); + compare!(>=); +} diff --git a/tests/ui/issues/issue-50825-1.rs b/tests/ui/issues/issue-50825-1.rs new file mode 100644 index 000000000..ee4316029 --- /dev/null +++ b/tests/ui/issues/issue-50825-1.rs @@ -0,0 +1,22 @@ +// run-pass +// regression test for issue #50825 +// Make sure that the `impl` bound (): X<T = ()> is preferred over +// the (): X bound in the where clause. + +trait X { + type T; +} + +trait Y<U>: X { + fn foo(x: &Self::T); +} + +impl X for () { + type T = (); +} + +impl<T> Y<Vec<T>> for () where (): Y<T> { + fn foo(_x: &()) {} +} + +fn main () {} diff --git a/tests/ui/issues/issue-50825.rs b/tests/ui/issues/issue-50825.rs new file mode 100644 index 000000000..1ece2e9fc --- /dev/null +++ b/tests/ui/issues/issue-50825.rs @@ -0,0 +1,15 @@ +// run-pass +// regression test for issue #50825 +// Make sure that the built-in bound {integer}: Sized is preferred over +// the u64: Sized bound in the where clause. + +fn foo(y: &[()]) +where + u64: Sized, +{ + y[0] +} + +fn main () { + foo(&[()]); +} diff --git a/tests/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs b/tests/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs new file mode 100644 index 000000000..1e20a5460 --- /dev/null +++ b/tests/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs @@ -0,0 +1,18 @@ +// revisions: default miropt +//[miropt]compile-flags: -Z mir-opt-level=3 +// ~^ This flag is for #77668, it used to be ICE. + +#![crate_type = "lib"] + +pub fn bar<P>( // Error won't happen if "bar" is not generic + _baz: P, +) { + hide_foo()(); +} + +fn hide_foo() -> impl Fn() { // Error won't happen if "iterate" hasn't impl Trait or has generics + foo +} + +fn foo() { // Error won't happen if "foo" isn't used in "iterate" or has generics +} diff --git a/tests/ui/issues/issue-50865-private-impl-trait/main.rs b/tests/ui/issues/issue-50865-private-impl-trait/main.rs new file mode 100644 index 000000000..16dfac53a --- /dev/null +++ b/tests/ui/issues/issue-50865-private-impl-trait/main.rs @@ -0,0 +1,16 @@ +// run-pass +// aux-build:lib.rs + +// Regression test for #50865. +// When using generics or specifying the type directly, this example +// codegens `foo` internally. However, when using a private `impl Trait` +// function which references another private item, `foo` (in this case) +// wouldn't be codegenned until main.rs used `bar`, as with impl Trait +// it is not cast to `fn()` automatically to satisfy e.g. +// `fn foo() -> fn() { ... }`. + +extern crate lib; + +fn main() { + lib::bar(()); // Error won't happen if bar is called from same crate +} diff --git a/tests/ui/issues/issue-5100.rs b/tests/ui/issues/issue-5100.rs new file mode 100644 index 000000000..69ed4b0e4 --- /dev/null +++ b/tests/ui/issues/issue-5100.rs @@ -0,0 +1,57 @@ +#![feature(box_patterns)] + + +enum A { B, C } + +fn main() { + match (true, false) { + A::B => (), +//~^ ERROR mismatched types +//~| expected tuple, found enum `A` +//~| expected tuple `(bool, bool)` +//~| found enum `A` + _ => () + } + + match (true, false) { + (true, false, false) => () +//~^ ERROR mismatched types +//~| expected a tuple with 2 elements, found one with 3 elements +//~| expected tuple `(bool, bool)` +//~| found tuple `(_, _, _)` + } + + match (true, false) { + (true, false, false) => () +//~^ ERROR mismatched types +//~| expected a tuple with 2 elements, found one with 3 elements +//~| expected tuple `(bool, bool)` +//~| found tuple `(_, _, _)` + } + + match (true, false) { + box (true, false) => () +//~^ ERROR mismatched types +//~| expected tuple `(bool, bool)` +//~| found struct `Box<_>` + } + + match (true, false) { + &(true, false) => () +//~^ ERROR mismatched types +//~| expected tuple, found reference +//~| expected tuple `(bool, bool)` +//~| found reference `&_` + } + + + let v = [('a', 'b') //~ ERROR expected function, found `(char, char)` + ('c', 'd'), + ('e', 'f')]; + + for &(x,y) in &v {} // should be OK + + // Make sure none of the errors above were fatal + let x: char = true; //~ ERROR mismatched types + //~| expected `char`, found `bool` +} diff --git a/tests/ui/issues/issue-5100.stderr b/tests/ui/issues/issue-5100.stderr new file mode 100644 index 000000000..c87a3e348 --- /dev/null +++ b/tests/ui/issues/issue-5100.stderr @@ -0,0 +1,76 @@ +error[E0308]: mismatched types + --> $DIR/issue-5100.rs:8:9 + | +LL | enum A { B, C } + | - unit variant defined here +... +LL | match (true, false) { + | ------------- this expression has type `(bool, bool)` +LL | A::B => (), + | ^^^^ expected tuple, found enum `A` + | + = note: expected tuple `(bool, bool)` + found enum `A` + +error[E0308]: mismatched types + --> $DIR/issue-5100.rs:17:9 + | +LL | match (true, false) { + | ------------- this expression has type `(bool, bool)` +LL | (true, false, false) => () + | ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements + | + = note: expected tuple `(bool, bool)` + found tuple `(_, _, _)` + +error[E0308]: mismatched types + --> $DIR/issue-5100.rs:25:9 + | +LL | match (true, false) { + | ------------- this expression has type `(bool, bool)` +LL | (true, false, false) => () + | ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements + | + = note: expected tuple `(bool, bool)` + found tuple `(_, _, _)` + +error[E0308]: mismatched types + --> $DIR/issue-5100.rs:33:9 + | +LL | match (true, false) { + | ------------- this expression has type `(bool, bool)` +LL | box (true, false) => () + | ^^^^^^^^^^^^^^^^^ expected tuple, found struct `Box` + | + = note: expected tuple `(bool, bool)` + found struct `Box<_>` + +error[E0308]: mismatched types + --> $DIR/issue-5100.rs:40:9 + | +LL | match (true, false) { + | ------------- this expression has type `(bool, bool)` +LL | &(true, false) => () + | ^^^^^^^^^^^^^^ expected tuple, found reference + | + = note: expected tuple `(bool, bool)` + found reference `&_` + +error[E0618]: expected function, found `(char, char)` + --> $DIR/issue-5100.rs:48:14 + | +LL | let v = [('a', 'b') + | ^^^^^^^^^^- help: consider separating array elements with a comma: `,` + +error[E0308]: mismatched types + --> $DIR/issue-5100.rs:55:19 + | +LL | let x: char = true; + | ---- ^^^^ expected `char`, found `bool` + | | + | expected due to this + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0308, E0618. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-51022.rs b/tests/ui/issues/issue-51022.rs new file mode 100644 index 000000000..cebdfe00c --- /dev/null +++ b/tests/ui/issues/issue-51022.rs @@ -0,0 +1,2 @@ +fn main<'a>() { } + //~^ ERROR `main` function is not allowed to have generic parameters [E0131] diff --git a/tests/ui/issues/issue-51022.stderr b/tests/ui/issues/issue-51022.stderr new file mode 100644 index 000000000..5e196bd4e --- /dev/null +++ b/tests/ui/issues/issue-51022.stderr @@ -0,0 +1,9 @@ +error[E0131]: `main` function is not allowed to have generic parameters + --> $DIR/issue-51022.rs:1:8 + | +LL | fn main<'a>() { } + | ^^^^ `main` cannot have generic parameters + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0131`. diff --git a/tests/ui/issues/issue-51044.rs b/tests/ui/issues/issue-51044.rs new file mode 100644 index 000000000..628d78769 --- /dev/null +++ b/tests/ui/issues/issue-51044.rs @@ -0,0 +1,30 @@ +// run-pass +// regression test for issue #50825 +// Check that the feature gate normalizes associated types. + +#![allow(dead_code)] +struct Foo<T>(T); +struct Duck; +struct Quack; + +trait Hello<A> where A: Animal { +} + +trait Animal { + type Noise; +} + +trait Loud<R> { +} + +impl Loud<Quack> for f32 { +} + +impl Animal for Duck { + type Noise = Quack; +} + +impl Hello<Duck> for Foo<f32> where f32: Loud<<Duck as Animal>::Noise> { +} + +fn main() {} diff --git a/tests/ui/issues/issue-51102.rs b/tests/ui/issues/issue-51102.rs new file mode 100644 index 000000000..41446cd29 --- /dev/null +++ b/tests/ui/issues/issue-51102.rs @@ -0,0 +1,38 @@ +enum SimpleEnum { + NoState, +} + +struct SimpleStruct { + no_state_here: u64, +} + +fn main() { + let _ = |simple| { + match simple { + SimpleStruct { + state: 0, + //~^ struct `SimpleStruct` does not have a field named `state` [E0026] + .. + } => (), + } + }; + + let _ = |simple| { + match simple { + SimpleStruct { + no_state_here: 0, + no_state_here: 1 + //~^ ERROR field `no_state_here` bound multiple times in the pattern [E0025] + } => (), + } + }; + + let _ = |simple| { + match simple { + SimpleEnum::NoState { + state: 0 + //~^ ERROR variant `SimpleEnum::NoState` does not have a field named `state` [E0026] + } => (), + } + }; +} diff --git a/tests/ui/issues/issue-51102.stderr b/tests/ui/issues/issue-51102.stderr new file mode 100644 index 000000000..09c52292d --- /dev/null +++ b/tests/ui/issues/issue-51102.stderr @@ -0,0 +1,27 @@ +error[E0026]: struct `SimpleStruct` does not have a field named `state` + --> $DIR/issue-51102.rs:13:17 + | +LL | state: 0, + | ^^^^^ + | | + | struct `SimpleStruct` does not have this field + | help: `SimpleStruct` has a field named `no_state_here` + +error[E0025]: field `no_state_here` bound multiple times in the pattern + --> $DIR/issue-51102.rs:24:17 + | +LL | no_state_here: 0, + | ---------------- first use of `no_state_here` +LL | no_state_here: 1 + | ^^^^^^^^^^^^^^^^ multiple uses of `no_state_here` in pattern + +error[E0026]: variant `SimpleEnum::NoState` does not have a field named `state` + --> $DIR/issue-51102.rs:33:17 + | +LL | state: 0 + | ^^^^^ variant `SimpleEnum::NoState` does not have this field + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0025, E0026. +For more information about an error, try `rustc --explain E0025`. diff --git a/tests/ui/issues/issue-51116.rs b/tests/ui/issues/issue-51116.rs new file mode 100644 index 000000000..4c21cbfc6 --- /dev/null +++ b/tests/ui/issues/issue-51116.rs @@ -0,0 +1,12 @@ +fn main() { + let tiles = Default::default(); + for row in &mut tiles { + for tile in row { + *tile = 0; + //~^ ERROR type annotations needed + //~| NOTE cannot infer type + } + } + + let tiles: [[usize; 3]; 3] = tiles; +} diff --git a/tests/ui/issues/issue-51116.stderr b/tests/ui/issues/issue-51116.stderr new file mode 100644 index 000000000..c07f8735e --- /dev/null +++ b/tests/ui/issues/issue-51116.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/issue-51116.rs:5:13 + | +LL | *tile = 0; + | ^^^^^ cannot infer type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-51154.rs b/tests/ui/issues/issue-51154.rs new file mode 100644 index 000000000..12903f790 --- /dev/null +++ b/tests/ui/issues/issue-51154.rs @@ -0,0 +1,6 @@ +fn foo<F: FnMut()>() { + let _: Box<F> = Box::new(|| ()); + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/issues/issue-51154.stderr b/tests/ui/issues/issue-51154.stderr new file mode 100644 index 000000000..d8a833a86 --- /dev/null +++ b/tests/ui/issues/issue-51154.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-51154.rs:2:30 + | +LL | fn foo<F: FnMut()>() { + | - this type parameter +LL | let _: Box<F> = Box::new(|| ()); + | -------- ^^^^^ expected type parameter `F`, found closure + | | + | arguments to this function are incorrect + | + = note: expected type parameter `F` + found closure `[closure@$DIR/issue-51154.rs:2:30: 2:32]` + = help: every closure has a distinct type and so could not always match the caller-chosen type of parameter `F` +note: associated function defined here + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-51515.rs b/tests/ui/issues/issue-51515.rs new file mode 100644 index 000000000..797c1085d --- /dev/null +++ b/tests/ui/issues/issue-51515.rs @@ -0,0 +1,10 @@ +fn main() { + let foo = &16; + //~^ HELP consider changing this to be a mutable reference + //~| SUGGESTION &mut 16 + *foo = 32; + //~^ ERROR cannot assign to `*foo`, which is behind a `&` reference + let bar = foo; + *bar = 64; + //~^ ERROR cannot assign to `*bar`, which is behind a `&` reference +} diff --git a/tests/ui/issues/issue-51515.stderr b/tests/ui/issues/issue-51515.stderr new file mode 100644 index 000000000..c4e61e719 --- /dev/null +++ b/tests/ui/issues/issue-51515.stderr @@ -0,0 +1,22 @@ +error[E0594]: cannot assign to `*foo`, which is behind a `&` reference + --> $DIR/issue-51515.rs:5:5 + | +LL | *foo = 32; + | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this to be a mutable reference + | +LL | let foo = &mut 16; + | ~~~~~~~ + +error[E0594]: cannot assign to `*bar`, which is behind a `&` reference + --> $DIR/issue-51515.rs:8:5 + | +LL | let bar = foo; + | --- consider changing this binding's type to be: `&mut i32` +LL | *bar = 64; + | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/issues/issue-5153.rs b/tests/ui/issues/issue-5153.rs new file mode 100644 index 000000000..5bf057903 --- /dev/null +++ b/tests/ui/issues/issue-5153.rs @@ -0,0 +1,12 @@ +trait Foo { + fn foo(self: Box<Self>); +} + +impl Foo for isize { + fn foo(self: Box<isize>) { } +} + +fn main() { + (&5isize as &dyn Foo).foo(); + //~^ ERROR: no method named `foo` found for reference `&dyn Foo` in the current scope +} diff --git a/tests/ui/issues/issue-5153.stderr b/tests/ui/issues/issue-5153.stderr new file mode 100644 index 000000000..93aaf4b9d --- /dev/null +++ b/tests/ui/issues/issue-5153.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `foo` found for reference `&dyn Foo` in the current scope + --> $DIR/issue-5153.rs:10:27 + | +LL | fn foo(self: Box<Self>); + | --------- the method might not be found because of this arbitrary self type +... +LL | (&5isize as &dyn Foo).foo(); + | ^^^ method not found in `&dyn Foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.rs b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.rs new file mode 100644 index 000000000..35402dff6 --- /dev/null +++ b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.rs @@ -0,0 +1,12 @@ +#![allow(dead_code)] + +fn missing_discourses() -> Result<isize, ()> { + Ok(1) +} + +fn forbidden_narratives() -> Result<isize, ()> { + missing_discourses()? + //~^ ERROR: `?` operator has incompatible types +} + +fn main() {} diff --git a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr new file mode 100644 index 000000000..cc0726bca --- /dev/null +++ b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -0,0 +1,22 @@ +error[E0308]: `?` operator has incompatible types + --> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5 + | +LL | missing_discourses()? + | ^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `isize` + | + = note: `?` operator cannot convert from `isize` to `Result<isize, ()>` + = note: expected enum `Result<isize, ()>` + found type `isize` +help: try removing this `?` + | +LL - missing_discourses()? +LL + missing_discourses() + | +help: try wrapping the expression in `Ok` + | +LL | Ok(missing_discourses()?) + | +++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-51655.rs b/tests/ui/issues/issue-51655.rs new file mode 100644 index 000000000..36fd90dab --- /dev/null +++ b/tests/ui/issues/issue-51655.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] + +const PATH_DOT: &[u8] = &[b'.']; + +fn match_slice(element: &[u8]) { + match element { + &[] => {} + PATH_DOT => {} + _ => {} + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-51714.rs b/tests/ui/issues/issue-51714.rs new file mode 100644 index 000000000..8716524d6 --- /dev/null +++ b/tests/ui/issues/issue-51714.rs @@ -0,0 +1,21 @@ +fn main() { +//~^ NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body +//~| NOTE: not the enclosing function body + |_: [_; return || {}] | {}; + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... + + [(); return || {}]; + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... + + [(); return |ice| {}]; + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... + + [(); return while let Some(n) = Some(0) {}]; + //~^ ERROR: return statement outside of function body [E0572] + //~| NOTE: the return is part of this body... +} diff --git a/tests/ui/issues/issue-51714.stderr b/tests/ui/issues/issue-51714.stderr new file mode 100644 index 000000000..514d69c1c --- /dev/null +++ b/tests/ui/issues/issue-51714.stderr @@ -0,0 +1,63 @@ +error[E0572]: return statement outside of function body + --> $DIR/issue-51714.rs:6:14 + | +LL | / fn main() { +LL | | +LL | | +LL | | +LL | | +LL | | |_: [_; return || {}] | {}; + | | ^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body + +error[E0572]: return statement outside of function body + --> $DIR/issue-51714.rs:10:10 + | +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return || {}]; + | | ^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body + +error[E0572]: return statement outside of function body + --> $DIR/issue-51714.rs:14:10 + | +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return |ice| {}]; + | | ^^^^^^^^^^^^^^^ the return is part of this body... +... | +LL | | +LL | | } + | |_- ...not the enclosing function body + +error[E0572]: return statement outside of function body + --> $DIR/issue-51714.rs:18:10 + | +LL | / fn main() { +LL | | +LL | | +LL | | +... | +LL | | [(); return while let Some(n) = Some(0) {}]; + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... +LL | | +LL | | +LL | | } + | |_- ...not the enclosing function body + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0572`. diff --git a/tests/ui/issues/issue-51798.rs b/tests/ui/issues/issue-51798.rs new file mode 100644 index 000000000..b075809e9 --- /dev/null +++ b/tests/ui/issues/issue-51798.rs @@ -0,0 +1,14 @@ +// edition:2018 +// aux-build:issue-51798.rs +// check-pass + +extern crate issue_51798; + +mod server { + fn f() { + let mut v = issue_51798::vec(); + v.clear(); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-51874.rs b/tests/ui/issues/issue-51874.rs new file mode 100644 index 000000000..d9d7e36b5 --- /dev/null +++ b/tests/ui/issues/issue-51874.rs @@ -0,0 +1,3 @@ +fn main() { + let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type +} diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr new file mode 100644 index 000000000..b39159a65 --- /dev/null +++ b/tests/ui/issues/issue-51874.stderr @@ -0,0 +1,14 @@ +error[E0689]: can't call method `pow` on ambiguous numeric type `{float}` + --> $DIR/issue-51874.rs:2:19 + | +LL | let a = (1.0).pow(1.0); + | ^^^ + | +help: you must specify a concrete type for this numeric value, like `f32` + | +LL | let a = (1.0_f32).pow(1.0); + | ~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0689`. diff --git a/tests/ui/issues/issue-51907.rs b/tests/ui/issues/issue-51907.rs new file mode 100644 index 000000000..9378f4357 --- /dev/null +++ b/tests/ui/issues/issue-51907.rs @@ -0,0 +1,19 @@ +// run-pass +trait Foo { + extern "C" fn borrow(&self); + extern "C" fn take(self: Box<Self>); +} + +struct Bar; +impl Foo for Bar { + #[allow(improper_ctypes_definitions)] + extern "C" fn borrow(&self) {} + #[allow(improper_ctypes_definitions)] + extern "C" fn take(self: Box<Self>) {} +} + +fn main() { + let foo: Box<dyn Foo> = Box::new(Bar); + foo.borrow(); + foo.take() +} diff --git a/tests/ui/issues/issue-5192.rs b/tests/ui/issues/issue-5192.rs new file mode 100644 index 000000000..e2f835c19 --- /dev/null +++ b/tests/ui/issues/issue-5192.rs @@ -0,0 +1,39 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub trait EventLoop { + fn dummy(&self) { } +} + +pub struct UvEventLoop { + uvio: isize +} + +impl UvEventLoop { + pub fn new() -> UvEventLoop { + UvEventLoop { + uvio: 0 + } + } +} + +impl EventLoop for UvEventLoop { +} + +pub struct Scheduler { + event_loop: Box<dyn EventLoop+'static>, +} + +impl Scheduler { + + pub fn new(event_loop: Box<dyn EventLoop+'static>) -> Scheduler { + Scheduler { + event_loop: event_loop, + } + } +} + +pub fn main() { + let _sched = Scheduler::new(Box::new(UvEventLoop::new()) as Box<dyn EventLoop>); +} diff --git a/tests/ui/issues/issue-51947.rs b/tests/ui/issues/issue-51947.rs new file mode 100644 index 000000000..c877fb8ae --- /dev/null +++ b/tests/ui/issues/issue-51947.rs @@ -0,0 +1,17 @@ +// build-pass + +#![crate_type = "lib"] +#![feature(linkage)] + +// MergeFunctions will merge these via an anonymous internal +// backing function, which must be named if ThinLTO buffers are used + +#[linkage = "weak"] +pub fn fn1(a: u32, b: u32, c: u32) -> u32 { + a + b + c +} + +#[linkage = "weak"] +pub fn fn2(a: u32, b: u32, c: u32) -> u32 { + a + b + c +} diff --git a/tests/ui/issues/issue-52049.rs b/tests/ui/issues/issue-52049.rs new file mode 100644 index 000000000..efdcc4493 --- /dev/null +++ b/tests/ui/issues/issue-52049.rs @@ -0,0 +1,8 @@ +fn foo(_: &'static u32) {} + +fn unpromotable<T>(t: T) -> T { t } + +fn main() { + foo(&unpromotable(5u32)); +} +//~^^ ERROR temporary value dropped while borrowed diff --git a/tests/ui/issues/issue-52049.stderr b/tests/ui/issues/issue-52049.stderr new file mode 100644 index 000000000..b25dbd1cb --- /dev/null +++ b/tests/ui/issues/issue-52049.stderr @@ -0,0 +1,14 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/issue-52049.rs:6:10 + | +LL | foo(&unpromotable(5u32)); + | -----^^^^^^^^^^^^^^^^^^- + | | | + | | creates a temporary value which is freed while still in use + | argument requires that borrow lasts for `'static` +LL | } + | - temporary value is freed at the end of this statement + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/issues/issue-52126-assign-op-invariance.rs b/tests/ui/issues/issue-52126-assign-op-invariance.rs new file mode 100644 index 000000000..c96cfdf3c --- /dev/null +++ b/tests/ui/issues/issue-52126-assign-op-invariance.rs @@ -0,0 +1,49 @@ +// Issue 52126: With respect to variance, the assign-op's like += were +// accidentally lumped together with other binary op's. In both cases +// we were coercing the LHS of the op to the expected supertype. +// +// The problem is that since the LHS of += is modified, we need the +// parameter to be invariant with respect to the overall type, not +// covariant. + +use std::collections::HashMap; +use std::ops::AddAssign; + +pub fn main() { + panics(); +} + +pub struct Counter<'l> { + map: HashMap<&'l str, usize>, +} + +impl<'l> AddAssign for Counter<'l> +{ + fn add_assign(&mut self, rhs: Counter<'l>) { + rhs.map.into_iter().for_each(|(key, val)| { + let count = self.map.entry(key).or_insert(0); + *count += val; + }); + } +} + +/// Often crashes, if not prints invalid strings. +pub fn panics() { + let mut acc = Counter{map: HashMap::new()}; + for line in vec!["123456789".to_string(), "12345678".to_string()] { + let v: Vec<&str> = line.split_whitespace().collect(); + //~^ ERROR `line` does not live long enough + // println!("accumulator before add_assign {:?}", acc.map); + let mut map = HashMap::new(); + for str_ref in v { + let e = map.entry(str_ref); + println!("entry: {:?}", e); + let count = e.or_insert(0); + *count += 1; + } + let cnt2 = Counter{map}; + acc += cnt2; + // println!("accumulator after add_assign {:?}", acc.map); + // line gets dropped here but references are kept in acc.map + } +} diff --git a/tests/ui/issues/issue-52126-assign-op-invariance.stderr b/tests/ui/issues/issue-52126-assign-op-invariance.stderr new file mode 100644 index 000000000..d45067577 --- /dev/null +++ b/tests/ui/issues/issue-52126-assign-op-invariance.stderr @@ -0,0 +1,15 @@ +error[E0597]: `line` does not live long enough + --> $DIR/issue-52126-assign-op-invariance.rs:34:28 + | +LL | let v: Vec<&str> = line.split_whitespace().collect(); + | ^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough +... +LL | acc += cnt2; + | --- borrow later used here +... +LL | } + | - `line` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/issues/issue-52140/auxiliary/some_crate.rs b/tests/ui/issues/issue-52140/auxiliary/some_crate.rs new file mode 100644 index 000000000..087005849 --- /dev/null +++ b/tests/ui/issues/issue-52140/auxiliary/some_crate.rs @@ -0,0 +1,5 @@ +#![crate_type = "lib"] + +pub fn hello() { + println!("Hello, world!"); +} diff --git a/tests/ui/issues/issue-52140/main.rs b/tests/ui/issues/issue-52140/main.rs new file mode 100644 index 000000000..aeac43404 --- /dev/null +++ b/tests/ui/issues/issue-52140/main.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:some_crate.rs +// compile-flags:--extern some_crate +// edition:2018 + +mod foo { + pub use some_crate; +} + +fn main() { + ::some_crate::hello(); + foo::some_crate::hello(); +} diff --git a/tests/ui/issues/issue-52141/auxiliary/some_crate.rs b/tests/ui/issues/issue-52141/auxiliary/some_crate.rs new file mode 100644 index 000000000..087005849 --- /dev/null +++ b/tests/ui/issues/issue-52141/auxiliary/some_crate.rs @@ -0,0 +1,5 @@ +#![crate_type = "lib"] + +pub fn hello() { + println!("Hello, world!"); +} diff --git a/tests/ui/issues/issue-52141/main.rs b/tests/ui/issues/issue-52141/main.rs new file mode 100644 index 000000000..7eea1726c --- /dev/null +++ b/tests/ui/issues/issue-52141/main.rs @@ -0,0 +1,16 @@ +// run-pass +// aux-build:some_crate.rs +// compile-flags:--extern some_crate +// edition:2018 + +use some_crate as some_name; + +mod foo { + pub use crate::some_name::*; +} + +fn main() { + ::some_crate::hello(); + some_name::hello(); + foo::hello(); +} diff --git a/tests/ui/issues/issue-52262.rs b/tests/ui/issues/issue-52262.rs new file mode 100644 index 000000000..547643f0d --- /dev/null +++ b/tests/ui/issues/issue-52262.rs @@ -0,0 +1,24 @@ +#[derive(Debug)] +enum MyError { + NotFound { key: Vec<u8> }, + Err41, +} + +impl std::error::Error for MyError {} + +impl std::fmt::Display for MyError { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + MyError::NotFound { key } => write!( + f, + "unknown error with code {}.", + String::from_utf8(*key).unwrap() + //~^ ERROR cannot move out of `*key` which is behind a shared reference + ), + MyError::Err41 => write!(f, "Sit by a lake"), + } + } +} +fn main() { + println!("Hello, world!"); +} diff --git a/tests/ui/issues/issue-52262.stderr b/tests/ui/issues/issue-52262.stderr new file mode 100644 index 000000000..ef41f078b --- /dev/null +++ b/tests/ui/issues/issue-52262.stderr @@ -0,0 +1,9 @@ +error[E0507]: cannot move out of `*key` which is behind a shared reference + --> $DIR/issue-52262.rs:15:35 + | +LL | String::from_utf8(*key).unwrap() + | ^^^^ move occurs because `*key` has type `Vec<u8>`, which does not implement the `Copy` trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/issues/issue-5239-1.rs b/tests/ui/issues/issue-5239-1.rs new file mode 100644 index 000000000..708ae34c6 --- /dev/null +++ b/tests/ui/issues/issue-5239-1.rs @@ -0,0 +1,6 @@ +// Regression test for issue #5239 + +fn main() { + let x = |ref x: isize| { x += 1; }; + //~^ ERROR E0368 +} diff --git a/tests/ui/issues/issue-5239-1.stderr b/tests/ui/issues/issue-5239-1.stderr new file mode 100644 index 000000000..f53ddb954 --- /dev/null +++ b/tests/ui/issues/issue-5239-1.stderr @@ -0,0 +1,11 @@ +error[E0368]: binary assignment operation `+=` cannot be applied to type `&isize` + --> $DIR/issue-5239-1.rs:4:30 + | +LL | let x = |ref x: isize| { x += 1; }; + | -^^^^^ + | | + | cannot use `+=` on type `&isize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0368`. diff --git a/tests/ui/issues/issue-5239-2.rs b/tests/ui/issues/issue-5239-2.rs new file mode 100644 index 000000000..b501c6e18 --- /dev/null +++ b/tests/ui/issues/issue-5239-2.rs @@ -0,0 +1,9 @@ +// run-pass +// Regression test for issue #5239 + + +pub fn main() { + let _f = |ref x: isize| { *x }; + let foo = 10; + assert_eq!(_f(foo), 10); +} diff --git a/tests/ui/issues/issue-52489.rs b/tests/ui/issues/issue-52489.rs new file mode 100644 index 000000000..8efe21698 --- /dev/null +++ b/tests/ui/issues/issue-52489.rs @@ -0,0 +1,8 @@ +// edition:2018 +// aux-build:issue-52489.rs +// compile-flags:--extern issue_52489 + +use issue_52489; +//~^ ERROR use of unstable library feature 'issue_52489_unstable' + +fn main() {} diff --git a/tests/ui/issues/issue-52489.stderr b/tests/ui/issues/issue-52489.stderr new file mode 100644 index 000000000..842ebd196 --- /dev/null +++ b/tests/ui/issues/issue-52489.stderr @@ -0,0 +1,11 @@ +error[E0658]: use of unstable library feature 'issue_52489_unstable' + --> $DIR/issue-52489.rs:5:5 + | +LL | use issue_52489; + | ^^^^^^^^^^^ + | + = help: add `#![feature(issue_52489_unstable)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-52533.rs b/tests/ui/issues/issue-52533.rs new file mode 100644 index 000000000..bb9a1911f --- /dev/null +++ b/tests/ui/issues/issue-52533.rs @@ -0,0 +1,7 @@ +fn foo(_: impl for<'a> FnOnce(&'a u32, &u32) -> &'a u32) { +} + +fn main() { + foo(|a, b| b) + //~^ ERROR lifetime may not live long enough +} diff --git a/tests/ui/issues/issue-52533.stderr b/tests/ui/issues/issue-52533.stderr new file mode 100644 index 000000000..c764736d7 --- /dev/null +++ b/tests/ui/issues/issue-52533.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-52533.rs:5:16 + | +LL | foo(|a, b| b) + | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | | | + | | has type `&'1 u32` + | has type `&'2 u32` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-52705/auxiliary/png2.rs b/tests/ui/issues/issue-52705/auxiliary/png2.rs new file mode 100644 index 000000000..fa9956e44 --- /dev/null +++ b/tests/ui/issues/issue-52705/auxiliary/png2.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub struct DecodingError; diff --git a/tests/ui/issues/issue-52705/main.rs b/tests/ui/issues/issue-52705/main.rs new file mode 100644 index 000000000..90bb8ca75 --- /dev/null +++ b/tests/ui/issues/issue-52705/main.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] +// aux-build:png2.rs +// compile-flags:--extern png2 +// edition:2018 + +mod png { + use png2 as png_ext; + + fn foo() -> png_ext::DecodingError { unimplemented!() } +} + +fn main() { + println!("Hello, world!"); +} diff --git a/tests/ui/issues/issue-52717.rs b/tests/ui/issues/issue-52717.rs new file mode 100644 index 000000000..f83232a4a --- /dev/null +++ b/tests/ui/issues/issue-52717.rs @@ -0,0 +1,13 @@ +enum A { + A { + foo: usize, + } +} + +fn main() { + let x = A::A { foo: 3 }; + match x { + A::A { fob } => { println!("{}", fob); } +//~^ ERROR does not have a field named `fob` + } +} diff --git a/tests/ui/issues/issue-52717.stderr b/tests/ui/issues/issue-52717.stderr new file mode 100644 index 000000000..468cdf2dc --- /dev/null +++ b/tests/ui/issues/issue-52717.stderr @@ -0,0 +1,12 @@ +error[E0026]: variant `A::A` does not have a field named `fob` + --> $DIR/issue-52717.rs:10:12 + | +LL | A::A { fob } => { println!("{}", fob); } + | ^^^ + | | + | variant `A::A` does not have this field + | help: a field with a similar name exists: `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0026`. diff --git a/tests/ui/issues/issue-5280.rs b/tests/ui/issues/issue-5280.rs new file mode 100644 index 000000000..5c5ce6c98 --- /dev/null +++ b/tests/ui/issues/issue-5280.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(dead_code)] + +type FontTableTag = u32; + +trait FontTableTagConversions { + fn tag_to_string(self); +} + +impl FontTableTagConversions for FontTableTag { + fn tag_to_string(self) { + let _ = &self; + } +} + +pub fn main() { + 5.tag_to_string(); +} diff --git a/tests/ui/issues/issue-5315.rs b/tests/ui/issues/issue-5315.rs new file mode 100644 index 000000000..0c121a5ee --- /dev/null +++ b/tests/ui/issues/issue-5315.rs @@ -0,0 +1,9 @@ +// run-pass +// pretty-expanded FIXME #23616 + +struct A(#[allow(unused_tuple_struct_fields)] bool); + +pub fn main() { + let f = A; + f(true); +} diff --git a/tests/ui/issues/issue-5321-immediates-with-bare-self.rs b/tests/ui/issues/issue-5321-immediates-with-bare-self.rs new file mode 100644 index 000000000..64aa2836a --- /dev/null +++ b/tests/ui/issues/issue-5321-immediates-with-bare-self.rs @@ -0,0 +1,15 @@ +// run-pass + +trait Fooable { + fn yes(self); +} + +impl Fooable for usize { + fn yes(self) { + for _ in 0..self { println!("yes"); } + } +} + +pub fn main() { + 2.yes(); +} diff --git a/tests/ui/issues/issue-53251.rs b/tests/ui/issues/issue-53251.rs new file mode 100644 index 000000000..240826a16 --- /dev/null +++ b/tests/ui/issues/issue-53251.rs @@ -0,0 +1,21 @@ +struct S; + +impl S { + fn f() {} +} + +macro_rules! impl_add { + ($($n:ident)*) => { + $( + fn $n() { + S::f::<i64>(); + //~^ ERROR this associated function takes 0 generic + //~| ERROR this associated function takes 0 generic + } + )* + } +} + +impl_add!(a b); + +fn main() { } diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr new file mode 100644 index 000000000..cee9a5deb --- /dev/null +++ b/tests/ui/issues/issue-53251.stderr @@ -0,0 +1,39 @@ +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-53251.rs:11:20 + | +LL | S::f::<i64>(); + | ^------- help: remove these generics + | | + | expected 0 generic arguments +... +LL | impl_add!(a b); + | -------------- in this macro invocation + | +note: associated function defined here, with 0 generic parameters + --> $DIR/issue-53251.rs:4:8 + | +LL | fn f() {} + | ^ + = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-53251.rs:11:20 + | +LL | S::f::<i64>(); + | ^------- help: remove these generics + | | + | expected 0 generic arguments +... +LL | impl_add!(a b); + | -------------- in this macro invocation + | +note: associated function defined here, with 0 generic parameters + --> $DIR/issue-53251.rs:4:8 + | +LL | fn f() {} + | ^ + = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-53275.rs b/tests/ui/issues/issue-53275.rs new file mode 100644 index 000000000..5ae6fb2d4 --- /dev/null +++ b/tests/ui/issues/issue-53275.rs @@ -0,0 +1,9 @@ +// build-pass + +#![crate_type = "lib"] +#![allow(unconditional_panic)] +struct S(u8); + +pub fn ice() { + S([][0]); +} diff --git a/tests/ui/issues/issue-53300.rs b/tests/ui/issues/issue-53300.rs new file mode 100644 index 000000000..09f0fe9d9 --- /dev/null +++ b/tests/ui/issues/issue-53300.rs @@ -0,0 +1,12 @@ +// issue 53300 + +pub trait A { + fn add(&self, b: i32) -> i32; +} + +fn addition() -> Wrapper<impl A> {} +//~^ ERROR cannot find type `Wrapper` in this scope [E0412] + +fn main() { + let res = addition(); +} diff --git a/tests/ui/issues/issue-53300.stderr b/tests/ui/issues/issue-53300.stderr new file mode 100644 index 000000000..2fedef7d2 --- /dev/null +++ b/tests/ui/issues/issue-53300.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Wrapper` in this scope + --> $DIR/issue-53300.rs:7:18 + | +LL | fn addition() -> Wrapper<impl A> {} + | ^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-53333.rs b/tests/ui/issues/issue-53333.rs new file mode 100644 index 000000000..ccc9971f9 --- /dev/null +++ b/tests/ui/issues/issue-53333.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(unused_imports)] +// edition:2018 + +fn main() { + use std; + let std = "std"; + println!("{}", std); +} diff --git a/tests/ui/issues/issue-53348.rs b/tests/ui/issues/issue-53348.rs new file mode 100644 index 000000000..d2f8c77c0 --- /dev/null +++ b/tests/ui/issues/issue-53348.rs @@ -0,0 +1,15 @@ +fn main() { + let mut v = vec!["hello", "this", "is", "a", "test"]; + + let v2 = Vec::new(); + + v.into_iter().map(|s|s.to_owned()).collect::<Vec<_>>(); + + let mut a = String::new(); //~ NOTE expected due to this value + for i in v { + a = *i.to_string(); + //~^ ERROR mismatched types + //~| NOTE expected struct `String`, found `str` + v2.push(a); + } +} diff --git a/tests/ui/issues/issue-53348.stderr b/tests/ui/issues/issue-53348.stderr new file mode 100644 index 000000000..71d9f5b3d --- /dev/null +++ b/tests/ui/issues/issue-53348.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-53348.rs:10:13 + | +LL | let mut a = String::new(); + | ------------- expected due to this value +LL | for i in v { +LL | a = *i.to_string(); + | ^^^^^^^^^^^^^^ expected struct `String`, found `str` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-53419.rs b/tests/ui/issues/issue-53419.rs new file mode 100644 index 000000000..892ec66af --- /dev/null +++ b/tests/ui/issues/issue-53419.rs @@ -0,0 +1,8 @@ +// check-pass + +struct Foo { + bar: dyn for<'r> Fn(usize, &'r dyn FnMut()) +} + +fn main() { +} diff --git a/tests/ui/issues/issue-53498.rs b/tests/ui/issues/issue-53498.rs new file mode 100644 index 000000000..9e0437c46 --- /dev/null +++ b/tests/ui/issues/issue-53498.rs @@ -0,0 +1,17 @@ +pub mod test { + pub struct A; + pub struct B; + pub struct Foo<T>(T); + + impl Foo<A> { + fn foo() {} + } + + impl Foo<B> { + fn foo() {} + } +} + +fn main() { + test::Foo::<test::B>::foo(); //~ ERROR associated function `foo` is private +} diff --git a/tests/ui/issues/issue-53498.stderr b/tests/ui/issues/issue-53498.stderr new file mode 100644 index 000000000..b28fbff62 --- /dev/null +++ b/tests/ui/issues/issue-53498.stderr @@ -0,0 +1,12 @@ +error[E0624]: associated function `foo` is private + --> $DIR/issue-53498.rs:16:27 + | +LL | fn foo() {} + | -------- private associated function defined here +... +LL | test::Foo::<test::B>::foo(); + | ^^^ private associated function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0624`. diff --git a/tests/ui/issues/issue-53568.rs b/tests/ui/issues/issue-53568.rs new file mode 100644 index 000000000..49ae444f9 --- /dev/null +++ b/tests/ui/issues/issue-53568.rs @@ -0,0 +1,47 @@ +// Regression test for an NLL-related ICE (#53568) -- we failed to +// resolve inference variables in "custom type-ops". +// +// check-pass + +trait Future { + type Item; +} + +impl<F, T> Future for F +where F: Fn() -> T +{ + type Item = T; +} + +trait Connect {} + +struct Connector<H> { + handler: H, +} + +impl<H, T> Connect for Connector<H> +where + T: 'static, + H: Future<Item = T> +{ +} + +struct Client<C> { + connector: C, +} + +fn build<C>(_connector: C) -> Client<C> { + unimplemented!() +} + +fn client<H>(handler: H) -> Client<impl Connect> +where H: Fn() + Copy +{ + let connector = Connector { + handler, + }; + let client = build(connector); + client +} + +fn main() { } diff --git a/tests/ui/issues/issue-5358-1.rs b/tests/ui/issues/issue-5358-1.rs new file mode 100644 index 000000000..f5e32e78d --- /dev/null +++ b/tests/ui/issues/issue-5358-1.rs @@ -0,0 +1,13 @@ +enum Either<T, U> { Left(T), Right(U) } +struct S(Either<usize, usize>); + +fn main() { + match S(Either::Left(5)) { + Either::Right(_) => {} + //~^ ERROR mismatched types + //~| expected struct `S`, found enum `Either` + //~| expected struct `S` + //~| found enum `Either<_, _>` + _ => {} + } +} diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr new file mode 100644 index 000000000..9d5b8d9d3 --- /dev/null +++ b/tests/ui/issues/issue-5358-1.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/issue-5358-1.rs:6:9 + | +LL | match S(Either::Left(5)) { + | ------------------ this expression has type `S` +LL | Either::Right(_) => {} + | ^^^^^^^^^^^^^^^^ expected struct `S`, found enum `Either` + | + = note: expected struct `S` + found enum `Either<_, _>` +help: try wrapping the pattern in `S` + | +LL | S(Either::Right(_)) => {} + | ++ + +help: you might have meant to use field `0` whose type is `Either<usize, usize>` + | +LL | match S(Either::Left(5)).0 { + | ~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-53712.rs b/tests/ui/issues/issue-53712.rs new file mode 100644 index 000000000..2353904d7 --- /dev/null +++ b/tests/ui/issues/issue-53712.rs @@ -0,0 +1,9 @@ +// issue #53712: make the error generated by using tuple indexing on an array more specific + +fn main() { + let arr = [10, 20, 30, 40, 50]; + arr.0; + //~^ ERROR no field `0` on type `[{integer}; 5]` [E0609] + //~| HELP instead of using tuple indexing, use array indexing + //~| SUGGESTION arr[0] +} diff --git a/tests/ui/issues/issue-53712.stderr b/tests/ui/issues/issue-53712.stderr new file mode 100644 index 000000000..db85919af --- /dev/null +++ b/tests/ui/issues/issue-53712.stderr @@ -0,0 +1,11 @@ +error[E0609]: no field `0` on type `[{integer}; 5]` + --> $DIR/issue-53712.rs:5:9 + | +LL | arr.0; + | ----^ + | | + | help: instead of using tuple indexing, use array indexing: `arr[0]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/issues/issue-53728.rs b/tests/ui/issues/issue-53728.rs new file mode 100644 index 000000000..77b5010f7 --- /dev/null +++ b/tests/ui/issues/issue-53728.rs @@ -0,0 +1,19 @@ +// run-pass + +#![allow(dead_code)] +#[repr(u16)] +enum DeviceKind { + Nil = 0, +} + +#[repr(packed)] +struct DeviceInfo { + endianness: u8, + device_kind: DeviceKind, +} + +fn main() { + let _x = None::<(DeviceInfo, u8)>; + let _y = None::<(DeviceInfo, u16)>; + let _z = None::<(DeviceInfo, u64)>; +} diff --git a/tests/ui/issues/issue-53843.rs b/tests/ui/issues/issue-53843.rs new file mode 100644 index 000000000..f305b370c --- /dev/null +++ b/tests/ui/issues/issue-53843.rs @@ -0,0 +1,26 @@ +// run-pass + +use std::ops::Deref; + +pub struct Pin<P>(P); + +impl<P, T> Deref for Pin<P> +where + P: Deref<Target=T>, +{ + type Target = T; + + fn deref(&self) -> &T { + &*self.0 + } +} + +impl<P> Pin<P> { + fn poll(self) {} +} + +fn main() { + let mut unit = (); + let pin = Pin(&mut unit); + pin.poll(); +} diff --git a/tests/ui/issues/issue-54044.rs b/tests/ui/issues/issue-54044.rs new file mode 100644 index 000000000..809ea7a87 --- /dev/null +++ b/tests/ui/issues/issue-54044.rs @@ -0,0 +1,13 @@ +#![deny(unused_attributes)] //~ NOTE lint level is defined here + +#[cold] +//~^ ERROR attribute should be applied to a function +//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +struct Foo; //~ NOTE not a function + +fn main() { + #[cold] + //~^ ERROR attribute should be applied to a function + //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + 5; //~ NOTE not a function +} diff --git a/tests/ui/issues/issue-54044.stderr b/tests/ui/issues/issue-54044.stderr new file mode 100644 index 000000000..8bd94a041 --- /dev/null +++ b/tests/ui/issues/issue-54044.stderr @@ -0,0 +1,29 @@ +error: attribute should be applied to a function definition + --> $DIR/issue-54044.rs:3:1 + | +LL | #[cold] + | ^^^^^^^ +... +LL | struct Foo; + | ----------- not a function definition + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +note: the lint level is defined here + --> $DIR/issue-54044.rs:1:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error: attribute should be applied to a function definition + --> $DIR/issue-54044.rs:9:5 + | +LL | #[cold] + | ^^^^^^^ +... +LL | 5; + | - not a function definition + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-54062.rs b/tests/ui/issues/issue-54062.rs new file mode 100644 index 000000000..093d6601d --- /dev/null +++ b/tests/ui/issues/issue-54062.rs @@ -0,0 +1,12 @@ +use std::sync::Mutex; + +struct Test { + comps: Mutex<String>, +} + +fn main() {} + +fn testing(test: Test) { + let _ = test.comps.inner.try_lock(); + //~^ ERROR: field `inner` of struct `Mutex` is private +} diff --git a/tests/ui/issues/issue-54062.stderr b/tests/ui/issues/issue-54062.stderr new file mode 100644 index 000000000..5361ee1d3 --- /dev/null +++ b/tests/ui/issues/issue-54062.stderr @@ -0,0 +1,9 @@ +error[E0616]: field `inner` of struct `Mutex` is private + --> $DIR/issue-54062.rs:10:24 + | +LL | let _ = test.comps.inner.try_lock(); + | ^^^^^ private field + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0616`. diff --git a/tests/ui/issues/issue-54094.rs b/tests/ui/issues/issue-54094.rs new file mode 100644 index 000000000..ec38dc40e --- /dev/null +++ b/tests/ui/issues/issue-54094.rs @@ -0,0 +1,14 @@ +// check-pass +trait Zoo { + type X; +} + +impl Zoo for u16 { + type X = usize; +} + +fn foo(abc: <u16 as Zoo>::X) {} + +fn main() { + let x: *const u8 = foo as _; +} diff --git a/tests/ui/issues/issue-54302-cases.rs b/tests/ui/issues/issue-54302-cases.rs new file mode 100644 index 000000000..faa116269 --- /dev/null +++ b/tests/ui/issues/issue-54302-cases.rs @@ -0,0 +1,85 @@ +trait Mirror { + type Image; + fn coerce(self) -> Self::Image; +} + +impl<T> Mirror for T { + type Image = T; + fn coerce(self) -> Self { self } +} + +trait Foo<'x, T> { + fn foo(self) -> &'x T; +} + +impl<'s, 'x, T: 'x> Foo<'x, T> for &'s T where &'s T: Foo2<'x, T> { + fn foo(self) -> &'x T { self.foo2() } +} + +trait Foo2<'x, T> { + fn foo2(self) -> &'x T; +} + +// example 1 - fails leak check +impl<'x> Foo2<'x, u32> for &'x u32 +{ + fn foo2(self) -> &'x u32 { self } +} + +// example 2 - OK with this issue +impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32 +{ + fn foo2(self) -> &'x i32 { self } +} + +// example 3 - fails due to issue #XYZ + Leak-check +impl<'x, T> Foo2<'x, u64> for T + where T: Mirror<Image=&'x u64> +{ + fn foo2(self) -> &'x u64 { self.coerce() } +} + +// example 4 - fails due to issue #XYZ +impl<'x, 'a: 'x, T> Foo2<'x, i64> for T + where T: Mirror<Image=&'a i64> +{ + fn foo2(self) -> &'x i64 { self.coerce() } +} + + +trait RefFoo<T> { + fn ref_foo(&self) -> &'static T; +} + +impl<T> RefFoo<T> for T where for<'a> &'a T: Foo<'static, T> { + fn ref_foo(&self) -> &'static T { + self.foo() + } +} + + +fn coerce_lifetime1(a: &u32) -> &'static u32 +{ + <u32 as RefFoo<u32>>::ref_foo(a) + //~^ ERROR not general enough +} + +fn coerce_lifetime2(a: &i32) -> &'static i32 +{ + <i32 as RefFoo<i32>>::ref_foo(a) + //~^ ERROR not general enough +} + +fn coerce_lifetime3(a: &u64) -> &'static u64 +{ + <u64 as RefFoo<u64>>::ref_foo(a) + //~^ ERROR not general enough +} + +fn coerce_lifetime4(a: &i64) -> &'static i64 +{ + <i64 as RefFoo<i64>>::ref_foo(a) + //~^ ERROR not general enough +} + +fn main() {} diff --git a/tests/ui/issues/issue-54302-cases.stderr b/tests/ui/issues/issue-54302-cases.stderr new file mode 100644 index 000000000..6e8b69c4b --- /dev/null +++ b/tests/ui/issues/issue-54302-cases.stderr @@ -0,0 +1,38 @@ +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:63:5 + | +LL | <u32 as RefFoo<u32>>::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... + = note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` + +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:69:5 + | +LL | <i32 as RefFoo<i32>>::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`... + = note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` + +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:75:5 + | +LL | <u64 as RefFoo<u64>>::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`... + = note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` + +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:81:5 + | +LL | <i64 as RefFoo<i64>>::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`... + = note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/issues/issue-54302.rs b/tests/ui/issues/issue-54302.rs new file mode 100644 index 000000000..1bfaebc38 --- /dev/null +++ b/tests/ui/issues/issue-54302.rs @@ -0,0 +1,19 @@ +trait Deserialize<'de> {} + +trait DeserializeOwned: for<'de> Deserialize<'de> {} +impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {} + +// Based on this impl, `&'static str` only implements Deserialize<'static>. +// It does not implement for<'de> Deserialize<'de>. +impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} + +fn main() { + // Then why does it implement DeserializeOwned? This compiles. + fn assert_deserialize_owned<T: DeserializeOwned>() {} + assert_deserialize_owned::<&'static str>(); + //~^ ERROR not general enough + + // It correctly does not implement for<'de> Deserialize<'de>. + //fn assert_hrtb<T: for<'de> Deserialize<'de>>() {} + //assert_hrtb::<&'static str>(); +} diff --git a/tests/ui/issues/issue-54302.stderr b/tests/ui/issues/issue-54302.stderr new file mode 100644 index 000000000..26c46571f --- /dev/null +++ b/tests/ui/issues/issue-54302.stderr @@ -0,0 +1,11 @@ +error: implementation of `Deserialize` is not general enough + --> $DIR/issue-54302.rs:13:5 + | +LL | assert_deserialize_owned::<&'static str>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough + | + = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0`... + = note: ...but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-5439.rs b/tests/ui/issues/issue-5439.rs new file mode 100644 index 000000000..852b264dc --- /dev/null +++ b/tests/ui/issues/issue-5439.rs @@ -0,0 +1,19 @@ +struct Foo { + foo: isize, +} + +struct Bar { + bar: isize, +} + +impl Bar { + fn make_foo (&self, i: isize) -> Box<Foo> { + return Box::new(Foo { nonexistent: self, foo: i }); //~ ERROR: no field named + } +} + +fn main () { + let bar = Bar { bar: 1 }; + let foo = bar.make_foo(2); + println!("{}", foo.foo); +} diff --git a/tests/ui/issues/issue-5439.stderr b/tests/ui/issues/issue-5439.stderr new file mode 100644 index 000000000..dc8f8b878 --- /dev/null +++ b/tests/ui/issues/issue-5439.stderr @@ -0,0 +1,11 @@ +error[E0560]: struct `Foo` has no field named `nonexistent` + --> $DIR/issue-5439.rs:11:31 + | +LL | return Box::new(Foo { nonexistent: self, foo: i }); + | ^^^^^^^^^^^ `Foo` does not have this field + | + = note: available fields are: `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0560`. diff --git a/tests/ui/issues/issue-54410.rs b/tests/ui/issues/issue-54410.rs new file mode 100644 index 000000000..e3e8ca985 --- /dev/null +++ b/tests/ui/issues/issue-54410.rs @@ -0,0 +1,8 @@ +extern "C" { + pub static mut symbol: [i8]; + //~^ ERROR the size for values of type `[i8]` cannot be known at compilation time +} + +fn main() { + println!("{:p}", unsafe { &symbol }); +} diff --git a/tests/ui/issues/issue-54410.stderr b/tests/ui/issues/issue-54410.stderr new file mode 100644 index 000000000..516c59afb --- /dev/null +++ b/tests/ui/issues/issue-54410.stderr @@ -0,0 +1,11 @@ +error[E0277]: the size for values of type `[i8]` cannot be known at compilation time + --> $DIR/issue-54410.rs:2:28 + | +LL | pub static mut symbol: [i8]; + | ^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[i8]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-54462-mutable-noalias-correctness.rs b/tests/ui/issues/issue-54462-mutable-noalias-correctness.rs new file mode 100644 index 000000000..412028bdc --- /dev/null +++ b/tests/ui/issues/issue-54462-mutable-noalias-correctness.rs @@ -0,0 +1,25 @@ +// run-pass +// +// compile-flags: -Ccodegen-units=1 -O + +fn linidx(row: usize, col: usize) -> usize { + row * 1 + col * 3 +} + +fn main() { + let mut mat = [1.0f32, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0]; + + for i in 0..2 { + for j in i+1..3 { + if mat[linidx(j, 3)] > mat[linidx(i, 3)] { + for k in 0..4 { + let (x, rest) = mat.split_at_mut(linidx(i, k) + 1); + let a = x.last_mut().unwrap(); + let b = rest.get_mut(linidx(j, k) - linidx(i, k) - 1).unwrap(); + ::std::mem::swap(a, b); + } + } + } + } + assert_eq!([9.0, 5.0, 1.0, 10.0, 6.0, 2.0, 11.0, 7.0, 3.0, 12.0, 8.0, 4.0], mat); +} diff --git a/tests/ui/issues/issue-54477-reduced-2.rs b/tests/ui/issues/issue-54477-reduced-2.rs new file mode 100644 index 000000000..199d69b45 --- /dev/null +++ b/tests/ui/issues/issue-54477-reduced-2.rs @@ -0,0 +1,26 @@ +// 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. + +use std::collections::VecDeque; + +fn main() { + let mut vecdeque_13 = VecDeque::from(vec![ ]); + let mut vecdeque_29 = VecDeque::from(vec![ 0 ]); + vecdeque_29.insert(0, 30 ); + vecdeque_29.insert(1, 31 ); + vecdeque_29.insert(2, 32 ); + vecdeque_29.insert(3, 33 ); + vecdeque_29.insert(4, 34 ); + vecdeque_29.insert(5, 35 ); + // println!("vecdeque_13: {:?}", vecdeque_13); + // println!("vecdeque_29: {:?}", vecdeque_29); + + // println!("Invoking: `vecdeque_13.append(&mut vecdeque_29)`"); + vecdeque_13.append(&mut vecdeque_29); + + // println!("vecdeque_13: {:?}", vecdeque_13); + + assert_eq!(vecdeque_13, VecDeque::from(vec![30, 31, 32, 33, 34, 35, 0])); +} diff --git a/tests/ui/issues/issue-54582.rs b/tests/ui/issues/issue-54582.rs new file mode 100644 index 000000000..8c50cac67 --- /dev/null +++ b/tests/ui/issues/issue-54582.rs @@ -0,0 +1,16 @@ +// run-pass + +pub trait Stage: Sync {} + +pub enum Enum { + A, + B, +} + +impl Stage for Enum {} + +pub static ARRAY: [(&dyn Stage, &str); 1] = [ + (&Enum::A, ""), +]; + +fn main() {} diff --git a/tests/ui/issues/issue-54696.rs b/tests/ui/issues/issue-54696.rs new file mode 100644 index 000000000..15355d30d --- /dev/null +++ b/tests/ui/issues/issue-54696.rs @@ -0,0 +1,8 @@ +// run-pass + +fn main() { + // We shouldn't promote this + let _ = &(main as fn() == main as fn()); + // Also check nested case + let _ = &(&(main as fn()) == &(main as fn())); +} diff --git a/tests/ui/issues/issue-5518.rs b/tests/ui/issues/issue-5518.rs new file mode 100644 index 000000000..97ed9ef30 --- /dev/null +++ b/tests/ui/issues/issue-5518.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-5518.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_5518 as other; + +fn main() {} diff --git a/tests/ui/issues/issue-5521.rs b/tests/ui/issues/issue-5521.rs new file mode 100644 index 000000000..cafdbc399 --- /dev/null +++ b/tests/ui/issues/issue-5521.rs @@ -0,0 +1,17 @@ +// run-pass +#![allow(dead_code)] +// aux-build:issue-5521.rs + + + +extern crate issue_5521 as foo; + +fn bar(a: foo::map) { + if false { + panic!(); + } else { + let _b = &(*a)[&2]; + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-55376.rs b/tests/ui/issues/issue-55376.rs new file mode 100644 index 000000000..4adff2b45 --- /dev/null +++ b/tests/ui/issues/issue-55376.rs @@ -0,0 +1,16 @@ +// run-pass +// Tests that paths in `pub(...)` don't fail HIR verification. + +#![allow(unused_imports)] +#![allow(dead_code)] + +pub(self) use self::my_mod::Foo; + +mod my_mod { + pub(super) use self::Foo as Bar; + pub(in super::my_mod) use self::Foo as Baz; + + pub struct Foo; +} + +fn main() {} diff --git a/tests/ui/issues/issue-55380.rs b/tests/ui/issues/issue-55380.rs new file mode 100644 index 000000000..f7cb296d3 --- /dev/null +++ b/tests/ui/issues/issue-55380.rs @@ -0,0 +1,28 @@ +// run-pass +#![feature(specialization)] +//~^ WARN the feature `specialization` is incomplete + +pub trait Foo { + fn abc() -> u32; + fn def() -> u32; +} + +pub trait Marker {} + +impl Marker for () {} + +impl<T> Foo for T { + default fn abc() -> u32 { 16 } + default fn def() -> u32 { 42 } +} + +impl<T: Marker> Foo for T { + fn def() -> u32 { + Self::abc() + } +} + +fn main() { + assert_eq!(<()>::def(), 16); + assert_eq!(<i32>::def(), 42); +} diff --git a/tests/ui/issues/issue-55380.stderr b/tests/ui/issues/issue-55380.stderr new file mode 100644 index 000000000..403844c72 --- /dev/null +++ b/tests/ui/issues/issue-55380.stderr @@ -0,0 +1,12 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-55380.rs:2:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/issues/issue-5550.rs b/tests/ui/issues/issue-5550.rs new file mode 100644 index 000000000..6ea24747b --- /dev/null +++ b/tests/ui/issues/issue-5550.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(unused_assignments)] +// pretty-expanded FIXME #23616 + +pub fn main() { + let s: String = "foobar".to_string(); + let mut t: &str = &s; + t = &t[0..3]; // for master: str::view(t, 0, 3) maybe +} diff --git a/tests/ui/issues/issue-5554.rs b/tests/ui/issues/issue-5554.rs new file mode 100644 index 000000000..7737536f4 --- /dev/null +++ b/tests/ui/issues/issue-5554.rs @@ -0,0 +1,29 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +use std::default::Default; + +pub struct X<T> { + a: T, +} + +// reordering these bounds stops the ICE +// +// nmatsakis: This test used to have the bounds Default + PartialEq + +// Default, but having duplicate bounds became illegal. +impl<T: Default + PartialEq> Default for X<T> { + fn default() -> X<T> { + X { a: Default::default() } + } +} + +macro_rules! constants { + () => { + let _ : X<isize> = Default::default(); + } +} + +pub fn main() { + constants!(); +} diff --git a/tests/ui/issues/issue-55587.rs b/tests/ui/issues/issue-55587.rs new file mode 100644 index 000000000..d9100cf55 --- /dev/null +++ b/tests/ui/issues/issue-55587.rs @@ -0,0 +1,5 @@ +use std::path::Path; + +fn main() { + let Path::new(); //~ ERROR expected tuple struct or tuple variant +} diff --git a/tests/ui/issues/issue-55587.stderr b/tests/ui/issues/issue-55587.stderr new file mode 100644 index 000000000..faf78cfe8 --- /dev/null +++ b/tests/ui/issues/issue-55587.stderr @@ -0,0 +1,11 @@ +error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new` + --> $DIR/issue-55587.rs:4:9 + | +LL | let Path::new(); + | ^^^^^^^^^^^ `fn` calls are not allowed in patterns + | + = help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0164`. diff --git a/tests/ui/issues/issue-5572.rs b/tests/ui/issues/issue-5572.rs new file mode 100644 index 000000000..175dc879d --- /dev/null +++ b/tests/ui/issues/issue-5572.rs @@ -0,0 +1,7 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +fn foo<T: ::std::cmp::PartialEq>(_t: T) { } + +pub fn main() { } diff --git a/tests/ui/issues/issue-55731.rs b/tests/ui/issues/issue-55731.rs new file mode 100644 index 000000000..7b4f4e2cd --- /dev/null +++ b/tests/ui/issues/issue-55731.rs @@ -0,0 +1,52 @@ +use std::marker::PhantomData; + +trait DistributedIterator { + fn reduce(self) + where + Self: Sized, + { + unreachable!() + } +} + +trait DistributedIteratorMulti<Source> { + type Item; +} + +struct Connect<I>(PhantomData<fn(I)>); +impl<I: for<'a> DistributedIteratorMulti<&'a ()>> DistributedIterator for Connect<I> where {} + +struct Cloned<Source>(PhantomData<fn(Source)>); +impl<'a, Source> DistributedIteratorMulti<&'a Source> for Cloned<&'a Source> { + type Item = (); +} + +struct Map<I, F> { + i: I, + f: F, +} +impl<I: DistributedIteratorMulti<Source>, F, Source> DistributedIteratorMulti<Source> for Map<I, F> +where + F: A<<I as DistributedIteratorMulti<Source>>::Item>, +{ + type Item = (); +} + +trait A<B> {} + +struct X; +impl A<()> for X {} + +fn multi<I>(_reducer: I) +where + I: for<'a> DistributedIteratorMulti<&'a ()>, +{ + DistributedIterator::reduce(Connect::<I>(PhantomData)) +} + +fn main() { + multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough + i: Cloned(PhantomData), + f: X, + }); +} diff --git a/tests/ui/issues/issue-55731.stderr b/tests/ui/issues/issue-55731.stderr new file mode 100644 index 000000000..97fd6678c --- /dev/null +++ b/tests/ui/issues/issue-55731.stderr @@ -0,0 +1,14 @@ +error: implementation of `DistributedIteratorMulti` is not general enough + --> $DIR/issue-55731.rs:48:5 + | +LL | / multi(Map { +LL | | i: Cloned(PhantomData), +LL | | f: X, +LL | | }); + | |______^ implementation of `DistributedIteratorMulti` is not general enough + | + = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`... + = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-56128.rs b/tests/ui/issues/issue-56128.rs new file mode 100644 index 000000000..10b50943c --- /dev/null +++ b/tests/ui/issues/issue-56128.rs @@ -0,0 +1,15 @@ +// Regression test for #56128. When this `pub(super) use...` gets +// exploded in the HIR, we were not handling ids correctly. +// +// check-pass + +mod bar { + pub(super) use self::baz::{x, y}; + + mod baz { + pub fn x() { } + pub fn y() { } + } +} + +fn main() { } diff --git a/tests/ui/issues/issue-56175.rs b/tests/ui/issues/issue-56175.rs new file mode 100644 index 000000000..ca1d0d431 --- /dev/null +++ b/tests/ui/issues/issue-56175.rs @@ -0,0 +1,9 @@ +// edition:2018 +// aux-crate:reexported_trait=reexported-trait.rs + +fn main() { + reexported_trait::FooStruct.trait_method(); + //~^ ERROR + reexported_trait::FooStruct.trait_method_b(); + //~^ ERROR +} diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr new file mode 100644 index 000000000..013a440ed --- /dev/null +++ b/tests/ui/issues/issue-56175.stderr @@ -0,0 +1,37 @@ +error[E0599]: no method named `trait_method` found for struct `FooStruct` in the current scope + --> $DIR/issue-56175.rs:5:33 + | +LL | reexported_trait::FooStruct.trait_method(); + | ^^^^^^^^^^^^ method not found in `FooStruct` + | + ::: $DIR/auxiliary/reexported-trait.rs:3:12 + | +LL | fn trait_method(&self) { + | ------------ the method is available for `FooStruct` here + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use reexported_trait::Trait; + | + +error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope + --> $DIR/issue-56175.rs:7:33 + | +LL | reexported_trait::FooStruct.trait_method_b(); + | ^^^^^^^^^^^^^^ method not found in `FooStruct` + | + ::: $DIR/auxiliary/reexported-trait.rs:7:12 + | +LL | fn trait_method_b(&self) { + | -------------- the method is available for `FooStruct` here + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL | use reexported_trait::TraitBRename; + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-56199.rs b/tests/ui/issues/issue-56199.rs new file mode 100644 index 000000000..ba11582a9 --- /dev/null +++ b/tests/ui/issues/issue-56199.rs @@ -0,0 +1,22 @@ +enum Foo {} +struct Bar {} + +impl Foo { + fn foo() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +impl Bar { + fn bar() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-56199.stderr b/tests/ui/issues/issue-56199.stderr new file mode 100644 index 000000000..7aaf8e4ac --- /dev/null +++ b/tests/ui/issues/issue-56199.stderr @@ -0,0 +1,30 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:6:17 + | +LL | let _ = Self; + | ^^^^ + | + = help: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:8:17 + | +LL | let _ = Self(); + | ^^^^ + | + = help: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:15:17 + | +LL | let _ = Self; + | ^^^^ help: use curly brackets: `Self { /* fields */ }` + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:17:17 + | +LL | let _ = Self(); + | ^^^^ help: use curly brackets: `Self { /* fields */ }` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/issues/issue-56229.rs b/tests/ui/issues/issue-56229.rs new file mode 100644 index 000000000..9e5897b98 --- /dev/null +++ b/tests/ui/issues/issue-56229.rs @@ -0,0 +1,35 @@ +// check-pass + +trait Mirror { + type Other; +} + +#[derive(Debug)] +struct Even(usize); +struct Odd; + +impl Mirror for Even { + type Other = Odd; +} + +impl Mirror for Odd { + type Other = Even; +} + +trait Dyn<T: Mirror>: AsRef<<T as Mirror>::Other> {} + +impl Dyn<Odd> for Even {} + +impl AsRef<Even> for Even { + fn as_ref(&self) -> &Even { + self + } +} + +fn code<T: Mirror>(d: &dyn Dyn<T>) -> &T::Other { + d.as_ref() +} + +fn main() { + println!("{:?}", code(&Even(22))); +} diff --git a/tests/ui/issues/issue-56237.rs b/tests/ui/issues/issue-56237.rs new file mode 100644 index 000000000..534b85ace --- /dev/null +++ b/tests/ui/issues/issue-56237.rs @@ -0,0 +1,13 @@ +// run-pass + +use std::ops::Deref; + +fn foo<P>(_value: <P as Deref>::Target) +where + P: Deref, + <P as Deref>::Target: Sized, +{} + +fn main() { + foo::<Box<u32>>(2); +} diff --git a/tests/ui/issues/issue-5666.rs b/tests/ui/issues/issue-5666.rs new file mode 100644 index 000000000..810895b1b --- /dev/null +++ b/tests/ui/issues/issue-5666.rs @@ -0,0 +1,26 @@ +// run-pass + +struct Dog { + name : String +} + +trait Barks { + fn bark(&self) -> String; +} + +impl Barks for Dog { + fn bark(&self) -> String { + return format!("woof! (I'm {})", self.name); + } +} + + +pub fn main() { + let snoopy = Box::new(Dog{name: "snoopy".to_string()}); + let bubbles = Box::new(Dog{name: "bubbles".to_string()}); + let barker = [snoopy as Box<dyn Barks>, bubbles as Box<dyn Barks>]; + + for pup in &barker { + println!("{}", pup.bark()); + } +} diff --git a/tests/ui/issues/issue-56806.rs b/tests/ui/issues/issue-56806.rs new file mode 100644 index 000000000..b1dac26d6 --- /dev/null +++ b/tests/ui/issues/issue-56806.rs @@ -0,0 +1,6 @@ +pub trait Trait { + fn dyn_instead_of_self(self: Box<dyn Trait>); + //~^ ERROR invalid `self` parameter type +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-56806.stderr b/tests/ui/issues/issue-56806.stderr new file mode 100644 index 000000000..f164fd0c5 --- /dev/null +++ b/tests/ui/issues/issue-56806.stderr @@ -0,0 +1,12 @@ +error[E0307]: invalid `self` parameter type: Box<(dyn Trait + 'static)> + --> $DIR/issue-56806.rs:2:34 + | +LL | fn dyn_instead_of_self(self: Box<dyn Trait>); + | ^^^^^^^^^^^^^^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0307`. diff --git a/tests/ui/issues/issue-56835.rs b/tests/ui/issues/issue-56835.rs new file mode 100644 index 000000000..7132d15ee --- /dev/null +++ b/tests/ui/issues/issue-56835.rs @@ -0,0 +1,9 @@ +pub struct Foo {} + +impl Foo { + fn bar(Self(foo): Self) {} + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + //~^^ ERROR expected tuple struct or tuple variant, found self constructor `Self` [E0164] +} + +fn main() {} diff --git a/tests/ui/issues/issue-56835.stderr b/tests/ui/issues/issue-56835.stderr new file mode 100644 index 000000000..e949ae7b3 --- /dev/null +++ b/tests/ui/issues/issue-56835.stderr @@ -0,0 +1,15 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56835.rs:4:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }` + +error[E0164]: expected tuple struct or tuple variant, found self constructor `Self` + --> $DIR/issue-56835.rs:4:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ not a tuple struct or tuple variant + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0164`. diff --git a/tests/ui/issues/issue-56870.rs b/tests/ui/issues/issue-56870.rs new file mode 100644 index 000000000..137a0ede0 --- /dev/null +++ b/tests/ui/issues/issue-56870.rs @@ -0,0 +1,38 @@ +// build-pass +// Regression test for #56870: Internal compiler error (traits & associated consts) + +use std::fmt::Debug; + +pub trait Foo<T> { + const FOO: *const u8; +} + +impl <T: Debug> Foo<T> for dyn Debug { + const FOO: *const u8 = <T as Debug>::fmt as *const u8; +} + +pub trait Bar { + const BAR: *const u8; +} + +pub trait Baz { + type Data: Debug; +} + +pub struct BarStruct<S: Baz>(S); + +impl<S: Baz> Bar for BarStruct<S> { + const BAR: *const u8 = <dyn Debug as Foo<<S as Baz>::Data>>::FOO; +} + +struct AnotherStruct; +#[derive(Debug)] +struct SomeStruct; + +impl Baz for AnotherStruct { + type Data = SomeStruct; +} + +fn main() { + let _x = <BarStruct<AnotherStruct> as Bar>::BAR; +} diff --git a/tests/ui/issues/issue-5688.rs b/tests/ui/issues/issue-5688.rs new file mode 100644 index 000000000..b6e364c2f --- /dev/null +++ b/tests/ui/issues/issue-5688.rs @@ -0,0 +1,20 @@ +// run-pass +/* +# Corrupted initialization in the static struct + +...should print &[1, 2, 3] but instead prints something like +&[4492532864, 24]. It is pretty evident that the compiler messed up +with the representation of [isize; n] and [isize] somehow, or at least +failed to typecheck correctly. +*/ + +#[derive(Copy, Clone)] +struct X { vec: &'static [isize] } + +static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; + +pub fn main() { + for &v in V { + println!("{:?}", v.vec); + } +} diff --git a/tests/ui/issues/issue-56943.rs b/tests/ui/issues/issue-56943.rs new file mode 100644 index 000000000..8fc77abdb --- /dev/null +++ b/tests/ui/issues/issue-56943.rs @@ -0,0 +1,8 @@ +// aux-build:issue-56943.rs + +extern crate issue_56943; + +fn main() { + let _: issue_56943::S = issue_56943::S2; + //~^ ERROR mismatched types [E0308] +} diff --git a/tests/ui/issues/issue-56943.stderr b/tests/ui/issues/issue-56943.stderr new file mode 100644 index 000000000..74ed5ec0f --- /dev/null +++ b/tests/ui/issues/issue-56943.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/issue-56943.rs:6:29 + | +LL | let _: issue_56943::S = issue_56943::S2; + | -------------- ^^^^^^^^^^^^^^^ expected struct `S`, found struct `S2` + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-5708.rs b/tests/ui/issues/issue-5708.rs new file mode 100644 index 000000000..6fe9943d3 --- /dev/null +++ b/tests/ui/issues/issue-5708.rs @@ -0,0 +1,55 @@ +// run-pass +#![allow(unused_variables)] +/* +# ICE when returning struct with reference to trait + +A function which takes a reference to a trait and returns a +struct with that reference results in an ICE. + +This does not occur with concrete types, only with references +to traits. +*/ + + +// original +trait Inner { + fn print(&self); +} + +impl Inner for isize { + fn print(&self) { print!("Inner: {}\n", *self); } +} + +struct Outer<'a> { + inner: &'a (dyn Inner+'a) +} + +impl<'a> Outer<'a> { + fn new(inner: &dyn Inner) -> Outer { + Outer { + inner: inner + } + } +} + +pub fn main() { + let inner: isize = 5; + let outer = Outer::new(&inner as &dyn Inner); + outer.inner.print(); +} + + +// minimal +pub trait MyTrait<T> { + fn dummy(&self, t: T) -> T { panic!() } +} + +pub struct MyContainer<'a, T:'a> { + foos: Vec<&'a (dyn MyTrait<T>+'a)> , +} + +impl<'a, T> MyContainer<'a, T> { + pub fn add (&mut self, foo: &'a dyn MyTrait<T>) { + self.foos.push(foo); + } +} diff --git a/tests/ui/issues/issue-57156.rs b/tests/ui/issues/issue-57156.rs new file mode 100644 index 000000000..9f5ec9f27 --- /dev/null +++ b/tests/ui/issues/issue-57156.rs @@ -0,0 +1,23 @@ +// check-pass + +trait Foo<Args> { + type Output; +} + +trait Bar<'a, T>: for<'s> Foo<&'s T, Output=bool> { + fn cb(&self) -> Box<dyn Bar<'a, T, Output=bool>>; +} + +impl<'s> Foo<&'s ()> for () { + type Output = bool; +} + +impl<'a> Bar<'a, ()> for () { + fn cb(&self) -> Box<dyn Bar<'a, (), Output=bool>> { + Box::new(*self) + } +} + +fn main() { + let _t = ().cb(); +} diff --git a/tests/ui/issues/issue-57162.rs b/tests/ui/issues/issue-57162.rs new file mode 100644 index 000000000..650700602 --- /dev/null +++ b/tests/ui/issues/issue-57162.rs @@ -0,0 +1,7 @@ +// check-pass + +trait Foo {} +impl Foo for dyn Send {} + +impl<T: Sync + Sync> Foo for T {} +fn main() {} diff --git a/tests/ui/issues/issue-5718.rs b/tests/ui/issues/issue-5718.rs new file mode 100644 index 000000000..f29a1e2a0 --- /dev/null +++ b/tests/ui/issues/issue-5718.rs @@ -0,0 +1,24 @@ +// run-pass +// pretty-expanded FIXME #23616 + +struct Element; + +macro_rules! foo { + ($tag: expr, $string: expr) => { + if $tag == $string { + let element: Box<_> = Box::new(Element); + unsafe { + return std::mem::transmute::<_, usize>(element); + } + } + } +} + +fn bar() -> usize { + foo!("a", "b"); + 0 +} + +fn main() { + bar(); +} diff --git a/tests/ui/issues/issue-57198-pass.rs b/tests/ui/issues/issue-57198-pass.rs new file mode 100644 index 000000000..3857def98 --- /dev/null +++ b/tests/ui/issues/issue-57198-pass.rs @@ -0,0 +1,9 @@ +// run-pass + +mod m { + pub fn r#for() {} +} + +fn main() { + m::r#for(); +} diff --git a/tests/ui/issues/issue-57271.rs b/tests/ui/issues/issue-57271.rs new file mode 100644 index 000000000..f74222e3e --- /dev/null +++ b/tests/ui/issues/issue-57271.rs @@ -0,0 +1,24 @@ +// aux-build:issue-57271-lib.rs + +extern crate issue_57271_lib; + +use issue_57271_lib::BaseType; + +pub enum ObjectType { //~ ERROR recursive types `ObjectType` and `TypeSignature` have infinite size + Class(ClassTypeSignature), + Array(TypeSignature), + TypeVariable(()), +} + +pub struct ClassTypeSignature { + pub package: (), + pub class: (), + pub inner: (), +} + +pub enum TypeSignature { + Base(BaseType), + Object(ObjectType), +} + +fn main() {} diff --git a/tests/ui/issues/issue-57271.stderr b/tests/ui/issues/issue-57271.stderr new file mode 100644 index 000000000..391e69c91 --- /dev/null +++ b/tests/ui/issues/issue-57271.stderr @@ -0,0 +1,27 @@ +error[E0072]: recursive types `ObjectType` and `TypeSignature` have infinite size + --> $DIR/issue-57271.rs:7:1 + | +LL | pub enum ObjectType { + | ^^^^^^^^^^^^^^^^^^^ +LL | Class(ClassTypeSignature), +LL | Array(TypeSignature), + | ------------- recursive without indirection +... +LL | pub enum TypeSignature { + | ^^^^^^^^^^^^^^^^^^^^^^ +LL | Base(BaseType), +LL | Object(ObjectType), + | ---------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL ~ Array(Box<TypeSignature>), +LL | TypeVariable(()), + ... +LL | Base(BaseType), +LL ~ Object(Box<ObjectType>), + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-57362-1.rs b/tests/ui/issues/issue-57362-1.rs new file mode 100644 index 000000000..1fa417fe9 --- /dev/null +++ b/tests/ui/issues/issue-57362-1.rs @@ -0,0 +1,23 @@ +// Test for issue #57362, ensuring that the self ty is shown in cases of higher-ranked lifetimes +// conflicts: the `expected` and `found` trait refs would otherwise be printed the same, leading +// to confusing notes such as: +// = note: expected type `Trait` +// found type `Trait` + +// from issue #57362 +trait Trait { + fn f(self); +} + +impl<T> Trait for fn(&T) { + fn f(self) { + println!("f"); + } +} + +fn f() { + let a: fn(_) = |_: &u8| {}; + a.f(); //~ ERROR no method named `f` +} + +fn main() {} diff --git a/tests/ui/issues/issue-57362-1.stderr b/tests/ui/issues/issue-57362-1.stderr new file mode 100644 index 000000000..b10273f14 --- /dev/null +++ b/tests/ui/issues/issue-57362-1.stderr @@ -0,0 +1,16 @@ +error[E0599]: no method named `f` found for fn pointer `fn(&u8)` in the current scope + --> $DIR/issue-57362-1.rs:20:7 + | +LL | a.f(); + | ^ method not found in `fn(&u8)` + | + = help: items from traits can only be used if the trait is implemented and in scope +note: `Trait` defines an item `f`, perhaps you need to implement it + --> $DIR/issue-57362-1.rs:8:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-57362-2.rs b/tests/ui/issues/issue-57362-2.rs new file mode 100644 index 000000000..a0b0ea1d0 --- /dev/null +++ b/tests/ui/issues/issue-57362-2.rs @@ -0,0 +1,25 @@ +// Test for issue #57362, ensuring that the self ty is shown in cases of higher-ranked lifetimes +// conflicts: the `expected` and `found` trait refs would otherwise be printed the same, leading +// to confusing notes such as: +// = note: expected type `Trait` +// found type `Trait` + +// extracted from a similar issue: #57642 +trait X { + type G; + fn make_g() -> Self::G; +} + +impl<'a> X for fn(&'a ()) { + type G = &'a (); + + fn make_g() -> Self::G { + &() + } +} + +fn g() { + let x = <fn (&())>::make_g(); //~ ERROR the function +} + +fn main() {} diff --git a/tests/ui/issues/issue-57362-2.stderr b/tests/ui/issues/issue-57362-2.stderr new file mode 100644 index 000000000..7d08c4643 --- /dev/null +++ b/tests/ui/issues/issue-57362-2.stderr @@ -0,0 +1,18 @@ +error[E0599]: the function or associated item `make_g` exists for fn pointer `for<'a> fn(&'a ())`, but its trait bounds were not satisfied + --> $DIR/issue-57362-2.rs:22:25 + | +LL | let x = <fn (&())>::make_g(); + | ^^^^^^ function or associated item cannot be called on `for<'a> fn(&'a ())` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `for<'a> fn(&'a ()): X` + = help: items from traits can only be used if the trait is implemented and in scope +note: `X` defines an item `make_g`, perhaps you need to implement it + --> $DIR/issue-57362-2.rs:8:1 + | +LL | trait X { + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-57399-self-return-impl-trait.rs b/tests/ui/issues/issue-57399-self-return-impl-trait.rs new file mode 100644 index 000000000..c7fe40e7b --- /dev/null +++ b/tests/ui/issues/issue-57399-self-return-impl-trait.rs @@ -0,0 +1,22 @@ +// check-pass + +trait T { + type T; +} + +impl T for i32 { + type T = u32; +} + +struct S<A> { + a: A, +} + + +impl From<u32> for S<<i32 as T>::T> { + fn from(a: u32) -> Self { + Self { a } + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-5741.rs b/tests/ui/issues/issue-5741.rs new file mode 100644 index 000000000..b9eaf0be7 --- /dev/null +++ b/tests/ui/issues/issue-5741.rs @@ -0,0 +1,9 @@ +// run-pass +// pretty-expanded FIXME #23616 +#![allow(while_true)] +#![allow(unreachable_code)] + +pub fn main() { + return; + while true {}; +} diff --git a/tests/ui/issues/issue-5754.rs b/tests/ui/issues/issue-5754.rs new file mode 100644 index 000000000..d90816635 --- /dev/null +++ b/tests/ui/issues/issue-5754.rs @@ -0,0 +1,16 @@ +// build-pass +#![allow(dead_code)] +#![allow(improper_ctypes)] + +// pretty-expanded FIXME #23616 + +struct TwoDoubles { + r: f64, + i: f64 +} + +extern "C" { + fn rust_dbg_extern_identity_TwoDoubles(arg1: TwoDoubles) -> TwoDoubles; +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-57741-1.rs b/tests/ui/issues/issue-57741-1.rs new file mode 100644 index 000000000..d0aae23b2 --- /dev/null +++ b/tests/ui/issues/issue-57741-1.rs @@ -0,0 +1,18 @@ +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion isn't made +// because the box doesn't deref to the type of the arm. + +enum S { + A { a: usize }, + B { b: usize }, +} + +fn main() { + let x = Box::new(3u32); + let y = match x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/tests/ui/issues/issue-57741-1.stderr b/tests/ui/issues/issue-57741-1.stderr new file mode 100644 index 000000000..789a1f44d --- /dev/null +++ b/tests/ui/issues/issue-57741-1.stderr @@ -0,0 +1,25 @@ +error[E0308]: mismatched types + --> $DIR/issue-57741-1.rs:14:9 + | +LL | let y = match x { + | - this expression has type `Box<u32>` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^ expected struct `Box`, found enum `S` + | + = note: expected struct `Box<u32>` + found enum `S` + +error[E0308]: mismatched types + --> $DIR/issue-57741-1.rs:14:22 + | +LL | let y = match x { + | - this expression has type `Box<u32>` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^^^^ expected struct `Box`, found enum `S` + | + = note: expected struct `Box<u32>` + found enum `S` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-57741.fixed b/tests/ui/issues/issue-57741.fixed new file mode 100644 index 000000000..4cae08003 --- /dev/null +++ b/tests/ui/issues/issue-57741.fixed @@ -0,0 +1,31 @@ +// run-rustfix + +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. + +enum S { + A { a: usize }, + B { b: usize }, +} + +enum T { + A(usize), + B(usize), +} + +fn main() { + let x = Box::new(T::A(3)); + let y = match *x { + T::A(a) | T::B(a) => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; + + let x = Box::new(S::A { a: 3 }); + let y = match *x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/tests/ui/issues/issue-57741.rs b/tests/ui/issues/issue-57741.rs new file mode 100644 index 000000000..e2658295a --- /dev/null +++ b/tests/ui/issues/issue-57741.rs @@ -0,0 +1,31 @@ +// run-rustfix + +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. + +enum S { + A { a: usize }, + B { b: usize }, +} + +enum T { + A(usize), + B(usize), +} + +fn main() { + let x = Box::new(T::A(3)); + let y = match x { + T::A(a) | T::B(a) => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; + + let x = Box::new(S::A { a: 3 }); + let y = match x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/tests/ui/issues/issue-57741.stderr b/tests/ui/issues/issue-57741.stderr new file mode 100644 index 000000000..cd277f20e --- /dev/null +++ b/tests/ui/issues/issue-57741.stderr @@ -0,0 +1,59 @@ +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:20:9 + | +LL | let y = match x { + | - + | | + | this expression has type `Box<T>` + | help: consider dereferencing the boxed value: `*x` +LL | T::A(a) | T::B(a) => a, + | ^^^^^^^ expected struct `Box`, found enum `T` + | + = note: expected struct `Box<T>` + found enum `T` + +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:20:19 + | +LL | let y = match x { + | - + | | + | this expression has type `Box<T>` + | help: consider dereferencing the boxed value: `*x` +LL | T::A(a) | T::B(a) => a, + | ^^^^^^^ expected struct `Box`, found enum `T` + | + = note: expected struct `Box<T>` + found enum `T` + +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:27:9 + | +LL | let y = match x { + | - + | | + | this expression has type `Box<S>` + | help: consider dereferencing the boxed value: `*x` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^ expected struct `Box`, found enum `S` + | + = note: expected struct `Box<S>` + found enum `S` + +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:27:22 + | +LL | let y = match x { + | - + | | + | this expression has type `Box<S>` + | help: consider dereferencing the boxed value: `*x` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^^^^ expected struct `Box`, found enum `S` + | + = note: expected struct `Box<S>` + found enum `S` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-57781.rs b/tests/ui/issues/issue-57781.rs new file mode 100644 index 000000000..f5015aaf5 --- /dev/null +++ b/tests/ui/issues/issue-57781.rs @@ -0,0 +1,20 @@ +// run-pass + +use std::cell::UnsafeCell; +use std::collections::HashMap; + +struct OnceCell<T> { + _value: UnsafeCell<Option<T>>, +} + +impl<T> OnceCell<T> { + const INIT: OnceCell<T> = OnceCell { + _value: UnsafeCell::new(None), + }; +} + +pub fn crash<K, T>() { + let _ = OnceCell::<HashMap<K, T>>::INIT; +} + +fn main() {} diff --git a/tests/ui/issues/issue-57924.rs b/tests/ui/issues/issue-57924.rs new file mode 100644 index 000000000..8846912a8 --- /dev/null +++ b/tests/ui/issues/issue-57924.rs @@ -0,0 +1,10 @@ +pub struct Gcm<E>(E); + +impl<E> Gcm<E> { + pub fn crash(e: E) -> Self { + Self::<E>(e) + //~^ ERROR type arguments are not allowed on self constructor + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-57924.stderr b/tests/ui/issues/issue-57924.stderr new file mode 100644 index 000000000..0323a4dfb --- /dev/null +++ b/tests/ui/issues/issue-57924.stderr @@ -0,0 +1,11 @@ +error[E0109]: type arguments are not allowed on self constructor + --> $DIR/issue-57924.rs:5:16 + | +LL | Self::<E>(e) + | ---- ^ type argument not allowed + | | + | not allowed on self constructor + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/issues/issue-58212.rs b/tests/ui/issues/issue-58212.rs new file mode 100644 index 000000000..4695497c3 --- /dev/null +++ b/tests/ui/issues/issue-58212.rs @@ -0,0 +1,15 @@ +// check-pass + +trait FromUnchecked { + fn from_unchecked(); +} + +impl FromUnchecked for [u8; 1] { + fn from_unchecked() { + let mut array: Self = [0; 1]; + let _ptr = &mut array as *mut [u8] as *mut u8; + } +} + +fn main() { +} diff --git a/tests/ui/issues/issue-58344.rs b/tests/ui/issues/issue-58344.rs new file mode 100644 index 000000000..0cb04dcb2 --- /dev/null +++ b/tests/ui/issues/issue-58344.rs @@ -0,0 +1,50 @@ +// check-pass + +use std::ops::Add; + +trait Trait<T> { + fn get(self) -> T; +} + +struct Holder<T>(T); + +impl<T> Trait<T> for Holder<T> { + fn get(self) -> T { + self.0 + } +} + +enum Either<L, R> { + Left(L), + Right(R), +} + +impl<L, R> Either<L, R> { + fn converge<T>(self) -> T + where + L: Trait<T>, + R: Trait<T>, + { + match self { + Either::Left(val) => val.get(), + Either::Right(val) => val.get(), + } + } +} + +fn add_generic<A: Add<B>, B>( + lhs: A, + rhs: B, +) -> Either<impl Trait<<A as Add<B>>::Output>, impl Trait<<A as Add<B>>::Output>> { + if true { Either::Left(Holder(lhs + rhs)) } else { Either::Right(Holder(lhs + rhs)) } +} + +fn add_one( + value: u32, +) -> Either<impl Trait<<u32 as Add<u32>>::Output>, impl Trait<<u32 as Add<u32>>::Output>> { + add_generic(value, 1u32) +} + +pub fn main() { + add_one(3).converge(); +} diff --git a/tests/ui/issues/issue-58375-monomorphize-default-impls.rs b/tests/ui/issues/issue-58375-monomorphize-default-impls.rs new file mode 100644 index 000000000..6da6f398d --- /dev/null +++ b/tests/ui/issues/issue-58375-monomorphize-default-impls.rs @@ -0,0 +1,24 @@ +// Make sure that the mono-item collector does not crash when trying to +// instantiate a default impl for DecodeUtf16<<u8 as A>::Item> +// See https://github.com/rust-lang/rust/issues/58375 + +// build-pass +// compile-flags:-C link-dead-code + +#![crate_type = "rlib"] + +pub struct DecodeUtf16<I>(I); + +pub trait Arbitrary { + fn arbitrary() {} +} + +pub trait A { + type Item; +} + +impl A for u8 { + type Item = char; +} + +impl Arbitrary for DecodeUtf16<<u8 as A>::Item> {} diff --git a/tests/ui/issues/issue-5844.mir.stderr b/tests/ui/issues/issue-5844.mir.stderr new file mode 100644 index 000000000..6134d6889 --- /dev/null +++ b/tests/ui/issues/issue-5844.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/issue-5844.rs:8:5 + | +LL | issue_5844_aux::rand(); + | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-5844.rs b/tests/ui/issues/issue-5844.rs new file mode 100644 index 000000000..4f90a9c66 --- /dev/null +++ b/tests/ui/issues/issue-5844.rs @@ -0,0 +1,9 @@ +//aux-build:issue-5844-aux.rs +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +extern crate issue_5844_aux; + +fn main () { + issue_5844_aux::rand(); //~ ERROR: requires unsafe +} diff --git a/tests/ui/issues/issue-5844.thir.stderr b/tests/ui/issues/issue-5844.thir.stderr new file mode 100644 index 000000000..310a2b593 --- /dev/null +++ b/tests/ui/issues/issue-5844.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block + --> $DIR/issue-5844.rs:8:5 + | +LL | issue_5844_aux::rand(); + | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-58463.rs b/tests/ui/issues/issue-58463.rs new file mode 100644 index 000000000..af93f7622 --- /dev/null +++ b/tests/ui/issues/issue-58463.rs @@ -0,0 +1,10 @@ +// run-pass +// compile-flags:-C debuginfo=2 +// ignore-asmjs wasm2js does not support source maps yet + +fn foo() -> impl Copy { + foo +} +fn main() { + foo(); +} diff --git a/tests/ui/issues/issue-58712.rs b/tests/ui/issues/issue-58712.rs new file mode 100644 index 000000000..930bec688 --- /dev/null +++ b/tests/ui/issues/issue-58712.rs @@ -0,0 +1,14 @@ +struct AddrVec<H, A> { + h: H, + a: A, +} + +impl<H> AddrVec<H, DeviceId> { + //~^ ERROR cannot find type `DeviceId` in this scope + pub fn device(&self) -> DeviceId { + //~^ ERROR cannot find type `DeviceId` in this scope + self.tail() + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-58712.stderr b/tests/ui/issues/issue-58712.stderr new file mode 100644 index 000000000..f4bd4d1e8 --- /dev/null +++ b/tests/ui/issues/issue-58712.stderr @@ -0,0 +1,20 @@ +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/issue-58712.rs:6:20 + | +LL | impl<H> AddrVec<H, DeviceId> { + | ^^^^^^^^ not found in this scope + | +help: you might be missing a type parameter + | +LL | impl<H, DeviceId> AddrVec<H, DeviceId> { + | ++++++++++ + +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/issue-58712.rs:8:29 + | +LL | pub fn device(&self) -> DeviceId { + | ^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-58734.rs b/tests/ui/issues/issue-58734.rs new file mode 100644 index 000000000..c838fde5d --- /dev/null +++ b/tests/ui/issues/issue-58734.rs @@ -0,0 +1,24 @@ +trait Trait { + fn exists(self) -> (); + + fn not_object_safe() -> Self; +} + +impl Trait for () { + fn exists(self) -> () { + } + + fn not_object_safe() -> Self { + () + } +} + +fn main() { + // object-safe or not, this call is OK + Trait::exists(()); + // no object safety error + Trait::nonexistent(()); + //~^ ERROR no function or associated item named `nonexistent` found + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition +} diff --git a/tests/ui/issues/issue-58734.stderr b/tests/ui/issues/issue-58734.stderr new file mode 100644 index 000000000..d2314626d --- /dev/null +++ b/tests/ui/issues/issue-58734.stderr @@ -0,0 +1,23 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-58734.rs:20:5 + | +LL | Trait::nonexistent(()); + | ^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `#[warn(bare_trait_objects)]` on by default +help: use `dyn` + | +LL | <dyn Trait>::nonexistent(()); + | ++++ + + +error[E0599]: no function or associated item named `nonexistent` found for trait object `dyn Trait` in the current scope + --> $DIR/issue-58734.rs:20:12 + | +LL | Trait::nonexistent(()); + | ^^^^^^^^^^^ function or associated item not found in `dyn Trait` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-5883.rs b/tests/ui/issues/issue-5883.rs new file mode 100644 index 000000000..82866b355 --- /dev/null +++ b/tests/ui/issues/issue-5883.rs @@ -0,0 +1,13 @@ +trait A {} + +struct Struct { + r: dyn A + 'static +} + +fn new_struct( + r: dyn A + 'static //~ ERROR the size for values of type +) -> Struct { //~ ERROR the size for values of type + Struct { r: r } +} + +fn main() {} diff --git a/tests/ui/issues/issue-5883.stderr b/tests/ui/issues/issue-5883.stderr new file mode 100644 index 000000000..ffff403e0 --- /dev/null +++ b/tests/ui/issues/issue-5883.stderr @@ -0,0 +1,36 @@ +error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time + --> $DIR/issue-5883.rs:8:5 + | +LL | r: dyn A + 'static + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn A + 'static)` + = help: unsized fn params are gated as an unstable feature +help: you can use `impl Trait` as the argument type + | +LL | r: impl A + 'static + | ~~~~ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | r: &dyn A + 'static + | + + +error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time + --> $DIR/issue-5883.rs:9:6 + | +LL | ) -> Struct { + | ^^^^^^ doesn't have a size known at compile-time +LL | Struct { r: r } + | --------------- this returned value is of type `Struct` + | + = help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)` +note: required because it appears within the type `Struct` + --> $DIR/issue-5883.rs:3:8 + | +LL | struct Struct { + | ^^^^^^ + = note: the return type of a function must have a statically known size + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-5884.rs b/tests/ui/issues/issue-5884.rs new file mode 100644 index 000000000..991c52321 --- /dev/null +++ b/tests/ui/issues/issue-5884.rs @@ -0,0 +1,18 @@ +// build-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub struct Foo { + a: isize, +} + +struct Bar<'a> { + a: Box<Option<isize>>, + b: &'a Foo, +} + +fn check(a: Box<Foo>) { + let _ic = Bar{ b: &*a, a: Box::new(None) }; +} + +pub fn main(){} diff --git a/tests/ui/issues/issue-58857.rs b/tests/ui/issues/issue-58857.rs new file mode 100644 index 000000000..4350d7e5b --- /dev/null +++ b/tests/ui/issues/issue-58857.rs @@ -0,0 +1,7 @@ +struct Conj<A> {a : A} +trait Valid {} + +impl<A: !Valid> Conj<A>{} +//~^ ERROR negative bounds are not supported + +fn main() {} diff --git a/tests/ui/issues/issue-58857.stderr b/tests/ui/issues/issue-58857.stderr new file mode 100644 index 000000000..e2acec47e --- /dev/null +++ b/tests/ui/issues/issue-58857.stderr @@ -0,0 +1,8 @@ +error: negative bounds are not supported + --> $DIR/issue-58857.rs:4:7 + | +LL | impl<A: !Valid> Conj<A>{} + | ^^^^^^^^ negative bounds are not supported + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-5900.rs b/tests/ui/issues/issue-5900.rs new file mode 100644 index 000000000..a7dc0eff4 --- /dev/null +++ b/tests/ui/issues/issue-5900.rs @@ -0,0 +1,15 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub mod foo { + use super::Bar; + + pub struct FooStruct { bar : Bar } +} + +pub enum Bar { + Bar0 = 0 as isize +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-59020.rs b/tests/ui/issues/issue-59020.rs new file mode 100644 index 000000000..a2b11764a --- /dev/null +++ b/tests/ui/issues/issue-59020.rs @@ -0,0 +1,27 @@ +// edition:2018 +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::time::Duration; + +fn main() { + let t1 = thread::spawn(|| { + let sleep = Duration::new(0,100_000); + for _ in 0..100 { + println!("Parking1"); + thread::park_timeout(sleep); + } + }); + + let t2 = thread::spawn(|| { + let sleep = Duration::new(0,100_000); + for _ in 0..100 { + println!("Parking2"); + thread::park_timeout(sleep); + } + }); + + t1.join().expect("Couldn't join thread 1"); + t2.join().expect("Couldn't join thread 2"); +} diff --git a/tests/ui/issues/issue-5917.rs b/tests/ui/issues/issue-5917.rs new file mode 100644 index 000000000..6ab7081cf --- /dev/null +++ b/tests/ui/issues/issue-5917.rs @@ -0,0 +1,9 @@ +// run-pass +#![allow(non_upper_case_globals)] + +struct T (&'static [isize]); +static t : T = T (&[5, 4, 3]); +pub fn main () { + let T(ref v) = t; + assert_eq!(v[0], 5); +} diff --git a/tests/ui/issues/issue-59326.rs b/tests/ui/issues/issue-59326.rs new file mode 100644 index 000000000..c0e883774 --- /dev/null +++ b/tests/ui/issues/issue-59326.rs @@ -0,0 +1,26 @@ +// check-pass +trait Service { + type S; +} + +trait Framing { + type F; +} + +impl Framing for () { + type F = (); +} + +trait HttpService<F: Framing>: Service<S = F::F> {} + +type BoxService = Box<dyn HttpService<(), S = ()>>; + +fn build_server<F: FnOnce() -> BoxService>(_: F) {} + +fn make_server<F: Framing>() -> Box<dyn HttpService<F, S = F::F>> { + unimplemented!() +} + +fn main() { + build_server(|| make_server()) +} diff --git a/tests/ui/issues/issue-59488.rs b/tests/ui/issues/issue-59488.rs new file mode 100644 index 000000000..384501e3e --- /dev/null +++ b/tests/ui/issues/issue-59488.rs @@ -0,0 +1,34 @@ +fn foo() -> i32 { + 42 +} + +fn bar(a: i64) -> i64 { + 43 +} + +enum Foo { + Bar(usize), +} + +fn main() { + foo > 12; + //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] + //~| ERROR mismatched types [E0308] + + bar > 13; + //~^ ERROR binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` [E0369] + //~| ERROR mismatched types [E0308] + + foo > foo; + //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] + + foo > bar; + //~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369] + //~| ERROR mismatched types [E0308] + + let i = Foo::Bar; + assert_eq!(Foo::Bar, i); + //~^ ERROR binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` [E0369] + //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] + //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] +} diff --git a/tests/ui/issues/issue-59488.stderr b/tests/ui/issues/issue-59488.stderr new file mode 100644 index 000000000..f9846b62a --- /dev/null +++ b/tests/ui/issues/issue-59488.stderr @@ -0,0 +1,127 @@ +error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` + --> $DIR/issue-59488.rs:14:9 + | +LL | foo > 12; + | --- ^ -- {integer} + | | + | fn() -> i32 {foo} + | +help: use parentheses to call this function + | +LL | foo() > 12; + | ++ + +error[E0308]: mismatched types + --> $DIR/issue-59488.rs:14:11 + | +LL | foo > 12; + | ^^ expected fn item, found integer + | + = note: expected fn item `fn() -> i32 {foo}` + found type `i32` + +error[E0369]: binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` + --> $DIR/issue-59488.rs:18:9 + | +LL | bar > 13; + | --- ^ -- {integer} + | | + | fn(i64) -> i64 {bar} + | +help: use parentheses to call this function + | +LL | bar(/* i64 */) > 13; + | +++++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-59488.rs:18:11 + | +LL | bar > 13; + | ^^ expected fn item, found integer + | + = note: expected fn item `fn(i64) -> i64 {bar}` + found type `i64` + +error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` + --> $DIR/issue-59488.rs:22:9 + | +LL | foo > foo; + | --- ^ --- fn() -> i32 {foo} + | | + | fn() -> i32 {foo} + | +help: use parentheses to call these + | +LL | foo() > foo(); + | ++ ++ + +error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` + --> $DIR/issue-59488.rs:25:9 + | +LL | foo > bar; + | --- ^ --- fn(i64) -> i64 {bar} + | | + | fn() -> i32 {foo} + +error[E0308]: mismatched types + --> $DIR/issue-59488.rs:25:11 + | +LL | foo > bar; + | ^^^ expected fn item, found a different fn item + | + = note: expected fn item `fn() -> i32 {foo}` + found fn item `fn(i64) -> i64 {bar}` + +error[E0369]: binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` + --> $DIR/issue-59488.rs:30:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | fn(usize) -> Foo {Foo::Bar} + | fn(usize) -> Foo {Foo::Bar} + | + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` + --> $DIR/issue-59488.rs:30:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` + = help: the following other types implement trait `Debug`: + extern "C" fn() -> Ret + extern "C" fn(A, B) -> Ret + extern "C" fn(A, B, ...) -> Ret + extern "C" fn(A, B, C) -> Ret + extern "C" fn(A, B, C, ...) -> Ret + extern "C" fn(A, B, C, D) -> Ret + extern "C" fn(A, B, C, D, ...) -> Ret + extern "C" fn(A, B, C, D, E) -> Ret + and 118 others + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` + --> $DIR/issue-59488.rs:30:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` + = help: the following other types implement trait `Debug`: + extern "C" fn() -> Ret + extern "C" fn(A, B) -> Ret + extern "C" fn(A, B, ...) -> Ret + extern "C" fn(A, B, C) -> Ret + extern "C" fn(A, B, C, ...) -> Ret + extern "C" fn(A, B, C, D) -> Ret + extern "C" fn(A, B, C, D, ...) -> Ret + extern "C" fn(A, B, C, D, E) -> Ret + and 118 others + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0277, E0308, E0369. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-59494.rs b/tests/ui/issues/issue-59494.rs new file mode 100644 index 000000000..a53e28f72 --- /dev/null +++ b/tests/ui/issues/issue-59494.rs @@ -0,0 +1,23 @@ +fn t7p<A, B, C>(f: impl Fn(B) -> C, g: impl Fn(A) -> B) -> impl Fn(A) -> C { + move |a: A| -> C { f(g(a)) } +} + +fn t8n<A, B, C>(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) +where + A: Copy, +{ + move |a: A| -> (B, C) { + let b = a; + let fa = f(a); + let ga = g(b); + (fa, ga) + } +} + +fn main() { + let f = |(_, _)| {}; + let g = |(a, _)| a; + let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); + let t8 = t8n(t7, t7p(f, g)); + //~^ ERROR: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))` [E0277] +} diff --git a/tests/ui/issues/issue-59494.stderr b/tests/ui/issues/issue-59494.stderr new file mode 100644 index 000000000..a9284535e --- /dev/null +++ b/tests/ui/issues/issue-59494.stderr @@ -0,0 +1,18 @@ +error[E0277]: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))` + --> $DIR/issue-59494.rs:21:22 + | +LL | let t8 = t8n(t7, t7p(f, g)); + | --- ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn(((_, _), _))` + | | + | required by a bound introduced by this call + | + = help: the trait `Fn<(_,)>` is not implemented for `impl Fn(((_, _), _))` +note: required by a bound in `t8n` + --> $DIR/issue-59494.rs:5:45 + | +LL | fn t8n<A, B, C>(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) + | ^^^^^^^^^^ required by this bound in `t8n` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-5950.rs b/tests/ui/issues/issue-5950.rs new file mode 100644 index 000000000..492a9d572 --- /dev/null +++ b/tests/ui/issues/issue-5950.rs @@ -0,0 +1,9 @@ +// check-pass + +// pretty-expanded FIXME #23616 + +pub use local as local_alias; + +pub mod local { } + +pub fn main() {} diff --git a/tests/ui/issues/issue-59756.fixed b/tests/ui/issues/issue-59756.fixed new file mode 100644 index 000000000..7b55d0f17 --- /dev/null +++ b/tests/ui/issues/issue-59756.fixed @@ -0,0 +1,17 @@ +// run-rustfix + +#![allow(warnings)] + +struct A; +struct B; + +fn foo() -> Result<A, B> { + Ok(A) +} + +fn bar() -> Result<A, B> { + foo() + //~^ ERROR try expression alternatives have incompatible types [E0308] +} + +fn main() {} diff --git a/tests/ui/issues/issue-59756.rs b/tests/ui/issues/issue-59756.rs new file mode 100644 index 000000000..d6df0592b --- /dev/null +++ b/tests/ui/issues/issue-59756.rs @@ -0,0 +1,21 @@ +// run-rustfix +// ignore-test +// +// FIXME: Re-enable this test once we support choosing +// between multiple mutually exclusive suggestions for the same span + +#![allow(warnings)] + +struct A; +struct B; + +fn foo() -> Result<A, B> { + Ok(A) +} + +fn bar() -> Result<A, B> { + foo()? + //~^ ERROR try expression alternatives have incompatible types [E0308] +} + +fn main() {} diff --git a/tests/ui/issues/issue-59756.stderr b/tests/ui/issues/issue-59756.stderr new file mode 100644 index 000000000..9066e57aa --- /dev/null +++ b/tests/ui/issues/issue-59756.stderr @@ -0,0 +1,20 @@ +error[E0308]: try expression alternatives have incompatible types + --> $DIR/issue-59756.rs:13:5 + | +LL | foo()? + | ^^^^^^ expected enum `std::result::Result`, found struct `A` + | + = note: expected enum `std::result::Result<A, B>` + found struct `A` +help: try removing this `?` + | +LL | foo() + | -- +help: try using a variant of the expected enum + | +LL | Ok(foo()?) + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-5988.rs b/tests/ui/issues/issue-5988.rs new file mode 100644 index 000000000..303fb4fbc --- /dev/null +++ b/tests/ui/issues/issue-5988.rs @@ -0,0 +1,24 @@ +// run-pass +// pretty-expanded FIXME #23616 + +trait B { + fn f(&self); +} + +trait T : B { +} + +struct A; + +impl<U: T> B for U { + fn f(&self) { } +} + +impl T for A { +} + +fn main() { + let a = A; + let br = &a as &dyn B; + br.f(); +} diff --git a/tests/ui/issues/issue-5997-enum.rs b/tests/ui/issues/issue-5997-enum.rs new file mode 100644 index 000000000..3ff4e036c --- /dev/null +++ b/tests/ui/issues/issue-5997-enum.rs @@ -0,0 +1,10 @@ +fn f<Z>() -> bool { + enum E { V(Z) } + //~^ ERROR can't use generic parameters from outer function + true +} + +fn main() { + let b = f::<isize>(); + assert!(b); +} diff --git a/tests/ui/issues/issue-5997-enum.stderr b/tests/ui/issues/issue-5997-enum.stderr new file mode 100644 index 000000000..3a79215d3 --- /dev/null +++ b/tests/ui/issues/issue-5997-enum.stderr @@ -0,0 +1,13 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/issue-5997-enum.rs:2:16 + | +LL | fn f<Z>() -> bool { + | - type parameter from outer function +LL | enum E { V(Z) } + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `<Z>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/issues/issue-5997-struct.rs b/tests/ui/issues/issue-5997-struct.rs new file mode 100644 index 000000000..6cf510b0a --- /dev/null +++ b/tests/ui/issues/issue-5997-struct.rs @@ -0,0 +1,10 @@ +fn f<T>() -> bool { + struct S(T); //~ ERROR can't use generic parameters from outer function + + true +} + +fn main() { + let b = f::<isize>(); + assert!(b); +} diff --git a/tests/ui/issues/issue-5997-struct.stderr b/tests/ui/issues/issue-5997-struct.stderr new file mode 100644 index 000000000..d2e97f767 --- /dev/null +++ b/tests/ui/issues/issue-5997-struct.stderr @@ -0,0 +1,13 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/issue-5997-struct.rs:2:14 + | +LL | fn f<T>() -> bool { + | - type parameter from outer function +LL | struct S(T); + | -^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `<T>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0401`. diff --git a/tests/ui/issues/issue-5997.rs b/tests/ui/issues/issue-5997.rs new file mode 100644 index 000000000..145e3a792 --- /dev/null +++ b/tests/ui/issues/issue-5997.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] + +fn f<T>() -> bool { + enum E<T> { V(T) } + + struct S<T>(T); + + true +} + +fn main() { + let b = f::<isize>(); + assert!(b); +} diff --git a/tests/ui/issues/issue-60218.rs b/tests/ui/issues/issue-60218.rs new file mode 100644 index 000000000..4926691f3 --- /dev/null +++ b/tests/ui/issues/issue-60218.rs @@ -0,0 +1,19 @@ +// Regression test for #60218 +// +// This was reported to cause ICEs. + +use std::iter::Map; + +pub trait Foo {} + +pub fn trigger_error<I, F>(iterable: I, functor: F) +where + for<'t> &'t I: IntoIterator, +for<'t> Map<<&'t I as IntoIterator>::IntoIter, F>: Iterator, +for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo, +{ +} + +fn main() { + trigger_error(vec![], |x: &u32| x) //~ ERROR E0277 +} diff --git a/tests/ui/issues/issue-60218.stderr b/tests/ui/issues/issue-60218.stderr new file mode 100644 index 000000000..dd72b6515 --- /dev/null +++ b/tests/ui/issues/issue-60218.stderr @@ -0,0 +1,20 @@ +error[E0277]: the trait bound `&u32: Foo` is not satisfied + --> $DIR/issue-60218.rs:18:19 + | +LL | trigger_error(vec![], |x: &u32| x) + | ------------- ^^^^^^ the trait `Foo` is not implemented for `&u32` + | | + | required by a bound introduced by this call + | +note: required by a bound in `trigger_error` + --> $DIR/issue-60218.rs:13:72 + | +LL | pub fn trigger_error<I, F>(iterable: I, functor: F) + | ------------- required by a bound in this +... +LL | for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo, + | ^^^ required by this bound in `trigger_error` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-60622.rs b/tests/ui/issues/issue-60622.rs new file mode 100644 index 000000000..8e230c615 --- /dev/null +++ b/tests/ui/issues/issue-60622.rs @@ -0,0 +1,16 @@ +#![deny(warnings)] + +struct Borked {} + +impl Borked { + fn a(&self) {} +} + +fn run_wild<T>(b: &Borked) { + b.a::<'_, T>(); + //~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present + //~| ERROR this associated function takes 0 generic arguments but 1 generic argument + //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +} + +fn main() {} diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr new file mode 100644 index 000000000..ecf1ae758 --- /dev/null +++ b/tests/ui/issues/issue-60622.stderr @@ -0,0 +1,35 @@ +error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present + --> $DIR/issue-60622.rs:10:11 + | +LL | fn a(&self) {} + | - the late bound lifetime parameter is introduced here +... +LL | b.a::<'_, T>(); + | ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868> +note: the lint level is defined here + --> $DIR/issue-60622.rs:1:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(late_bound_lifetime_arguments)]` implied by `#[deny(warnings)]` + +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-60622.rs:10:7 + | +LL | b.a::<'_, T>(); + | ^ - help: remove this generic argument + | | + | expected 0 generic arguments + | +note: associated function defined here, with 0 generic parameters + --> $DIR/issue-60622.rs:6:8 + | +LL | fn a(&self) {} + | ^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-60989.rs b/tests/ui/issues/issue-60989.rs new file mode 100644 index 000000000..29db3fdb4 --- /dev/null +++ b/tests/ui/issues/issue-60989.rs @@ -0,0 +1,18 @@ +struct A {} +struct B {} + +impl From<A> for B { + fn from(a: A) -> B { + B{} + } +} + +fn main() { + let c1 = (); + c1::<()>; + //~^ ERROR type arguments are not allowed on local variable + + let c1 = A {}; + c1::<dyn Into<B>>; + //~^ ERROR type arguments are not allowed on local variable +} diff --git a/tests/ui/issues/issue-60989.stderr b/tests/ui/issues/issue-60989.stderr new file mode 100644 index 000000000..e0236567b --- /dev/null +++ b/tests/ui/issues/issue-60989.stderr @@ -0,0 +1,19 @@ +error[E0109]: type arguments are not allowed on local variable + --> $DIR/issue-60989.rs:12:10 + | +LL | c1::<()>; + | -- ^^ type argument not allowed + | | + | not allowed on local variable + +error[E0109]: type arguments are not allowed on local variable + --> $DIR/issue-60989.rs:16:10 + | +LL | c1::<dyn Into<B>>; + | -- ^^^^^^^^^^^ type argument not allowed + | | + | not allowed on local variable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/issues/issue-61106.rs b/tests/ui/issues/issue-61106.rs new file mode 100644 index 000000000..308ef1de3 --- /dev/null +++ b/tests/ui/issues/issue-61106.rs @@ -0,0 +1,6 @@ +fn main() { + let x = String::new(); + foo(x.clone()); //~ ERROR mismatched types +} + +fn foo(_: &str) {} diff --git a/tests/ui/issues/issue-61106.stderr b/tests/ui/issues/issue-61106.stderr new file mode 100644 index 000000000..2bc092341 --- /dev/null +++ b/tests/ui/issues/issue-61106.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-61106.rs:3:9 + | +LL | foo(x.clone()); + | --- ^^^^^^^^^ + | | | + | | expected `&str`, found struct `String` + | | help: consider borrowing here: `&x` + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-61106.rs:6:4 + | +LL | fn foo(_: &str) {} + | ^^^ ------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-61108.rs b/tests/ui/issues/issue-61108.rs new file mode 100644 index 000000000..0a883b958 --- /dev/null +++ b/tests/ui/issues/issue-61108.rs @@ -0,0 +1,7 @@ +fn main() { + let mut bad_letters = vec!['e', 't', 'o', 'i']; + for l in bad_letters { + // something here + } + bad_letters.push('s'); //~ ERROR borrow of moved value: `bad_letters` +} diff --git a/tests/ui/issues/issue-61108.stderr b/tests/ui/issues/issue-61108.stderr new file mode 100644 index 000000000..3aaf5fb3f --- /dev/null +++ b/tests/ui/issues/issue-61108.stderr @@ -0,0 +1,21 @@ +error[E0382]: borrow of moved value: `bad_letters` + --> $DIR/issue-61108.rs:6:5 + | +LL | let mut bad_letters = vec!['e', 't', 'o', 'i']; + | --------------- move occurs because `bad_letters` has type `Vec<char>`, which does not implement the `Copy` trait +LL | for l in bad_letters { + | ----------- `bad_letters` moved due to this implicit call to `.into_iter()` +... +LL | bad_letters.push('s'); + | ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move + | +note: `into_iter` takes ownership of the receiver `self`, which moves `bad_letters` + --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL +help: consider iterating over a slice of the `Vec<char>`'s content to avoid moving into the `for` loop + | +LL | for l in &bad_letters { + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-6117.rs b/tests/ui/issues/issue-6117.rs new file mode 100644 index 000000000..5235d53d8 --- /dev/null +++ b/tests/ui/issues/issue-6117.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +enum Either<T, U> { Left(T), Right(U) } + +pub fn main() { + match Either::Left(Box::new(17)) { + Either::Right(()) => {} + _ => {} + } +} diff --git a/tests/ui/issues/issue-6130.rs b/tests/ui/issues/issue-6130.rs new file mode 100644 index 000000000..a33ea6869 --- /dev/null +++ b/tests/ui/issues/issue-6130.rs @@ -0,0 +1,10 @@ +// run-pass + +pub fn main() { + let i: usize = 0; + assert!(i <= 0xFFFF_FFFF); + + let i: isize = 0; + assert!(i >= -0x8000_0000); + assert!(i <= 0x7FFF_FFFF); +} diff --git a/tests/ui/issues/issue-61475.rs b/tests/ui/issues/issue-61475.rs new file mode 100644 index 000000000..680449c9e --- /dev/null +++ b/tests/ui/issues/issue-61475.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(dead_code)] + +enum E { + A, B +} + +fn main() { + match &&E::A { + &&E::A => { + } + &&E::B => { + } + }; +} diff --git a/tests/ui/issues/issue-6153.rs b/tests/ui/issues/issue-6153.rs new file mode 100644 index 000000000..25f026f21 --- /dev/null +++ b/tests/ui/issues/issue-6153.rs @@ -0,0 +1,13 @@ +// run-pass + + +fn swap<F>(f: F) -> Vec<isize> where F: FnOnce(Vec<isize>) -> Vec<isize> { + let x = vec![1, 2, 3]; + f(x) +} + +pub fn main() { + let v = swap(|mut x| { x.push(4); x }); + let w = swap(|mut x| { x.push(4); x }); + assert_eq!(v, w); +} diff --git a/tests/ui/issues/issue-61623.rs b/tests/ui/issues/issue-61623.rs new file mode 100644 index 000000000..82df50d9d --- /dev/null +++ b/tests/ui/issues/issue-61623.rs @@ -0,0 +1,10 @@ +fn f1<'a>(_: &'a mut ()) {} + +fn f2<P>(_: P, _: ()) {} + +fn f3<'a>(x: &'a ((), &'a mut ())) { + f2(|| x.0, f1(x.1)) +//~^ ERROR cannot borrow `*x.1` as mutable, as it is behind a `&` reference +} + +fn main() {} diff --git a/tests/ui/issues/issue-61623.stderr b/tests/ui/issues/issue-61623.stderr new file mode 100644 index 000000000..5fcc33855 --- /dev/null +++ b/tests/ui/issues/issue-61623.stderr @@ -0,0 +1,14 @@ +error[E0596]: cannot borrow `*x.1` as mutable, as it is behind a `&` reference + --> $DIR/issue-61623.rs:6:19 + | +LL | f2(|| x.0, f1(x.1)) + | ^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider changing this to be a mutable reference + | +LL | fn f3<'a>(x: &'a mut ((), &'a mut ())) { + | ~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/issues/issue-61696.rs b/tests/ui/issues/issue-61696.rs new file mode 100644 index 000000000..dca52927f --- /dev/null +++ b/tests/ui/issues/issue-61696.rs @@ -0,0 +1,66 @@ +// run-pass + +pub enum Infallible {} + +// The check that the `bool` field of `V1` is encoding a "niche variant" +// (i.e. not `V1`, so `V3` or `V4`) used to be mathematically incorrect, +// causing valid `V1` values to be interpreted as other variants. +pub enum E1 { + V1 { f: bool }, + V2 { f: Infallible }, + V3, + V4, +} + +// Computing the discriminant used to be done using the niche type (here `u8`, +// from the `bool` field of `V1`), overflowing for variants with large enough +// indices (`V3` and `V4`), causing them to be interpreted as other variants. +pub enum E2<X> { + V1 { f: bool }, + + /*_00*/ _01(X), _02(X), _03(X), _04(X), _05(X), _06(X), _07(X), + _08(X), _09(X), _0A(X), _0B(X), _0C(X), _0D(X), _0E(X), _0F(X), + _10(X), _11(X), _12(X), _13(X), _14(X), _15(X), _16(X), _17(X), + _18(X), _19(X), _1A(X), _1B(X), _1C(X), _1D(X), _1E(X), _1F(X), + _20(X), _21(X), _22(X), _23(X), _24(X), _25(X), _26(X), _27(X), + _28(X), _29(X), _2A(X), _2B(X), _2C(X), _2D(X), _2E(X), _2F(X), + _30(X), _31(X), _32(X), _33(X), _34(X), _35(X), _36(X), _37(X), + _38(X), _39(X), _3A(X), _3B(X), _3C(X), _3D(X), _3E(X), _3F(X), + _40(X), _41(X), _42(X), _43(X), _44(X), _45(X), _46(X), _47(X), + _48(X), _49(X), _4A(X), _4B(X), _4C(X), _4D(X), _4E(X), _4F(X), + _50(X), _51(X), _52(X), _53(X), _54(X), _55(X), _56(X), _57(X), + _58(X), _59(X), _5A(X), _5B(X), _5C(X), _5D(X), _5E(X), _5F(X), + _60(X), _61(X), _62(X), _63(X), _64(X), _65(X), _66(X), _67(X), + _68(X), _69(X), _6A(X), _6B(X), _6C(X), _6D(X), _6E(X), _6F(X), + _70(X), _71(X), _72(X), _73(X), _74(X), _75(X), _76(X), _77(X), + _78(X), _79(X), _7A(X), _7B(X), _7C(X), _7D(X), _7E(X), _7F(X), + _80(X), _81(X), _82(X), _83(X), _84(X), _85(X), _86(X), _87(X), + _88(X), _89(X), _8A(X), _8B(X), _8C(X), _8D(X), _8E(X), _8F(X), + _90(X), _91(X), _92(X), _93(X), _94(X), _95(X), _96(X), _97(X), + _98(X), _99(X), _9A(X), _9B(X), _9C(X), _9D(X), _9E(X), _9F(X), + _A0(X), _A1(X), _A2(X), _A3(X), _A4(X), _A5(X), _A6(X), _A7(X), + _A8(X), _A9(X), _AA(X), _AB(X), _AC(X), _AD(X), _AE(X), _AF(X), + _B0(X), _B1(X), _B2(X), _B3(X), _B4(X), _B5(X), _B6(X), _B7(X), + _B8(X), _B9(X), _BA(X), _BB(X), _BC(X), _BD(X), _BE(X), _BF(X), + _C0(X), _C1(X), _C2(X), _C3(X), _C4(X), _C5(X), _C6(X), _C7(X), + _C8(X), _C9(X), _CA(X), _CB(X), _CC(X), _CD(X), _CE(X), _CF(X), + _D0(X), _D1(X), _D2(X), _D3(X), _D4(X), _D5(X), _D6(X), _D7(X), + _D8(X), _D9(X), _DA(X), _DB(X), _DC(X), _DD(X), _DE(X), _DF(X), + _E0(X), _E1(X), _E2(X), _E3(X), _E4(X), _E5(X), _E6(X), _E7(X), + _E8(X), _E9(X), _EA(X), _EB(X), _EC(X), _ED(X), _EE(X), _EF(X), + _F0(X), _F1(X), _F2(X), _F3(X), _F4(X), _F5(X), _F6(X), _F7(X), + _F8(X), _F9(X), _FA(X), _FB(X), _FC(X), _FD(X), _FE(X), _FF(X), + + V3, + V4, +} + +fn main() { + if let E1::V2 { .. } = (E1::V1 { f: true }) { + unreachable!() + } + + if let E2::V1 { .. } = E2::V3::<Infallible> { + unreachable!() + } +} diff --git a/tests/ui/issues/issue-61894.rs b/tests/ui/issues/issue-61894.rs new file mode 100644 index 000000000..776fdbb74 --- /dev/null +++ b/tests/ui/issues/issue-61894.rs @@ -0,0 +1,21 @@ +// run-pass + +#![feature(core_intrinsics)] + +use std::any::type_name; + +struct Bar<M>(#[allow(unused_tuple_struct_fields)] M); + +impl<M> Bar<M> { + fn foo(&self) -> &'static str { + fn f() {} + fn type_name_of<T>(_: T) -> &'static str { + type_name::<T>() + } + type_name_of(f) + } +} + +fn main() { + assert_eq!(Bar(()).foo(), "issue_61894::Bar<_>::foo::f"); +} diff --git a/tests/ui/issues/issue-62375.rs b/tests/ui/issues/issue-62375.rs new file mode 100644 index 000000000..a2c8fe551 --- /dev/null +++ b/tests/ui/issues/issue-62375.rs @@ -0,0 +1,9 @@ +enum A { + Value(()) +} + +fn main() { + let a = A::Value(()); + a == A::Value; + //~^ ERROR binary operation `==` cannot be applied to type `A` +} diff --git a/tests/ui/issues/issue-62375.stderr b/tests/ui/issues/issue-62375.stderr new file mode 100644 index 000000000..478e025be --- /dev/null +++ b/tests/ui/issues/issue-62375.stderr @@ -0,0 +1,21 @@ +error[E0369]: binary operation `==` cannot be applied to type `A` + --> $DIR/issue-62375.rs:7:7 + | +LL | a == A::Value; + | - ^^ -------- fn(()) -> A {A::Value} + | | + | A + | +note: an implementation of `PartialEq<_>` might be missing for `A` + --> $DIR/issue-62375.rs:1:1 + | +LL | enum A { + | ^^^^^^ must implement `PartialEq<_>` +help: consider annotating `A` with `#[derive(PartialEq)]` + | +LL | #[derive(PartialEq)] + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-62480.rs b/tests/ui/issues/issue-62480.rs new file mode 100644 index 000000000..94a9c2ab8 --- /dev/null +++ b/tests/ui/issues/issue-62480.rs @@ -0,0 +1,10 @@ +fn main() { + // This used to ICE during liveness check because `target_id` passed to + // `propagate_through_expr` would be the closure and not the `loop`, which wouldn't be found in + // `self.break_ln`. (#62480) + 'a: { + || break 'a + //~^ ERROR use of unreachable label `'a` + //~| ERROR `break` inside of a closure + } +} diff --git a/tests/ui/issues/issue-62480.stderr b/tests/ui/issues/issue-62480.stderr new file mode 100644 index 000000000..db2305370 --- /dev/null +++ b/tests/ui/issues/issue-62480.stderr @@ -0,0 +1,22 @@ +error[E0767]: use of unreachable label `'a` + --> $DIR/issue-62480.rs:6:18 + | +LL | 'a: { + | -- unreachable label defined here +LL | || break 'a + | ^^ unreachable label `'a` + | + = note: labels are unreachable through functions, closures, async blocks and modules + +error[E0267]: `break` inside of a closure + --> $DIR/issue-62480.rs:6:12 + | +LL | || break 'a + | -- ^^^^^^^^ cannot `break` inside of a closure + | | + | enclosing closure + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0267, E0767. +For more information about an error, try `rustc --explain E0267`. diff --git a/tests/ui/issues/issue-6318.rs b/tests/ui/issues/issue-6318.rs new file mode 100644 index 000000000..e5f245f6f --- /dev/null +++ b/tests/ui/issues/issue-6318.rs @@ -0,0 +1,20 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub enum Thing { + A(Box<dyn Foo+'static>) +} + +pub trait Foo { + fn dummy(&self) { } +} + +pub struct Struct; + +impl Foo for Struct {} + +pub fn main() { + match Thing::A(Box::new(Struct) as Box<dyn Foo + 'static>) { + Thing::A(_a) => 0, + }; +} diff --git a/tests/ui/issues/issue-6344-let.rs b/tests/ui/issues/issue-6344-let.rs new file mode 100644 index 000000000..a7b6a2e2d --- /dev/null +++ b/tests/ui/issues/issue-6344-let.rs @@ -0,0 +1,15 @@ +// run-pass +#![allow(non_shorthand_field_patterns)] + +struct A { x: usize } + +impl Drop for A { + fn drop(&mut self) {} +} + +pub fn main() { + let a = A { x: 0 }; + + let A { x: ref x } = a; + println!("{}", x) +} diff --git a/tests/ui/issues/issue-6344-match.rs b/tests/ui/issues/issue-6344-match.rs new file mode 100644 index 000000000..4505a34c7 --- /dev/null +++ b/tests/ui/issues/issue-6344-match.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(non_shorthand_field_patterns)] + +struct A { x: usize } + +impl Drop for A { + fn drop(&mut self) {} +} + +pub fn main() { + let a = A { x: 0 }; + + match a { + A { x : ref x } => { + println!("{}", x) + } + } +} diff --git a/tests/ui/issues/issue-63983.rs b/tests/ui/issues/issue-63983.rs new file mode 100644 index 000000000..ab952666f --- /dev/null +++ b/tests/ui/issues/issue-63983.rs @@ -0,0 +1,15 @@ +enum MyEnum { + Tuple(i32), + Struct{ s: i32 }, +} + +fn foo(en: MyEnum) { + match en { + MyEnum::Tuple => "", +//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple` + MyEnum::Struct => "", +//~^ ERROR expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct` + }; +} + +fn main() {} diff --git a/tests/ui/issues/issue-63983.stderr b/tests/ui/issues/issue-63983.stderr new file mode 100644 index 000000000..f90c81116 --- /dev/null +++ b/tests/ui/issues/issue-63983.stderr @@ -0,0 +1,19 @@ +error[E0532]: expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple` + --> $DIR/issue-63983.rs:8:9 + | +LL | Tuple(i32), + | ---------- `MyEnum::Tuple` defined here +... +LL | MyEnum::Tuple => "", + | ^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `MyEnum::Tuple(_)` + +error[E0533]: expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct` + --> $DIR/issue-63983.rs:10:9 + | +LL | MyEnum::Struct => "", + | ^^^^^^^^^^^^^^ not a unit struct, unit variant or constant + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0532, E0533. +For more information about an error, try `rustc --explain E0532`. diff --git a/tests/ui/issues/issue-64430.rs b/tests/ui/issues/issue-64430.rs new file mode 100644 index 000000000..0bc66e06e --- /dev/null +++ b/tests/ui/issues/issue-64430.rs @@ -0,0 +1,14 @@ +// compile-flags:-C panic=abort + +#![no_std] +pub struct Foo; + +fn main() { + Foo.bar() + //~^ ERROR E0599 +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop{} +} diff --git a/tests/ui/issues/issue-64430.stderr b/tests/ui/issues/issue-64430.stderr new file mode 100644 index 000000000..b6b1f3a66 --- /dev/null +++ b/tests/ui/issues/issue-64430.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `bar` found for struct `Foo` in the current scope + --> $DIR/issue-64430.rs:7:9 + | +LL | pub struct Foo; + | -------------- method `bar` not found for this struct +... +LL | Foo.bar() + | ^^^ method not found in `Foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-64559.rs b/tests/ui/issues/issue-64559.rs new file mode 100644 index 000000000..71e054b5d --- /dev/null +++ b/tests/ui/issues/issue-64559.rs @@ -0,0 +1,6 @@ +fn main() { + let orig = vec![true]; + for _val in orig {} + let _closure = || orig; + //~^ ERROR use of moved value: `orig` +} diff --git a/tests/ui/issues/issue-64559.stderr b/tests/ui/issues/issue-64559.stderr new file mode 100644 index 000000000..386ac794d --- /dev/null +++ b/tests/ui/issues/issue-64559.stderr @@ -0,0 +1,22 @@ +error[E0382]: use of moved value: `orig` + --> $DIR/issue-64559.rs:4:20 + | +LL | let orig = vec![true]; + | ---- move occurs because `orig` has type `Vec<bool>`, which does not implement the `Copy` trait +LL | for _val in orig {} + | ---- `orig` moved due to this implicit call to `.into_iter()` +LL | let _closure = || orig; + | ^^ ---- use occurs due to use in closure + | | + | value used here after move + | +note: `into_iter` takes ownership of the receiver `self`, which moves `orig` + --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL +help: consider iterating over a slice of the `Vec<bool>`'s content to avoid moving into the `for` loop + | +LL | for _val in &orig {} + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-6458-1.rs b/tests/ui/issues/issue-6458-1.rs new file mode 100644 index 000000000..184e4832b --- /dev/null +++ b/tests/ui/issues/issue-6458-1.rs @@ -0,0 +1,8 @@ +// run-fail +// error-pattern:explicit panic +// ignore-emscripten no processes + +fn foo<T>(t: T) {} +fn main() { + foo(panic!()) +} diff --git a/tests/ui/issues/issue-6458-2.rs b/tests/ui/issues/issue-6458-2.rs new file mode 100644 index 000000000..b18cae3ed --- /dev/null +++ b/tests/ui/issues/issue-6458-2.rs @@ -0,0 +1,5 @@ +fn main() { + // Unconstrained type: + format!("{:?}", None); + //~^ ERROR type annotations needed [E0282] +} diff --git a/tests/ui/issues/issue-6458-2.stderr b/tests/ui/issues/issue-6458-2.stderr new file mode 100644 index 000000000..8dbdd9a27 --- /dev/null +++ b/tests/ui/issues/issue-6458-2.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-6458-2.rs:3:21 + | +LL | format!("{:?}", None); + | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` + | +help: consider specifying the generic argument + | +LL | format!("{:?}", None::<T>); + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-6458-3.rs b/tests/ui/issues/issue-6458-3.rs new file mode 100644 index 000000000..d4f8886e9 --- /dev/null +++ b/tests/ui/issues/issue-6458-3.rs @@ -0,0 +1,6 @@ +use std::mem; + +fn main() { + mem::transmute(0); + //~^ ERROR type annotations needed [E0282] +} diff --git a/tests/ui/issues/issue-6458-3.stderr b/tests/ui/issues/issue-6458-3.stderr new file mode 100644 index 000000000..520efccae --- /dev/null +++ b/tests/ui/issues/issue-6458-3.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-6458-3.rs:4:5 + | +LL | mem::transmute(0); + | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `Dst` declared on the function `transmute` + | +help: consider specifying the generic arguments + | +LL | mem::transmute::<i32, Dst>(0); + | ++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-6458-4.rs b/tests/ui/issues/issue-6458-4.rs new file mode 100644 index 000000000..054a5c15c --- /dev/null +++ b/tests/ui/issues/issue-6458-4.rs @@ -0,0 +1,7 @@ +fn foo(b: bool) -> Result<bool,String> { //~ ERROR mismatched types + Err("bar".to_string()); +} + +fn main() { + foo(false); +} diff --git a/tests/ui/issues/issue-6458-4.stderr b/tests/ui/issues/issue-6458-4.stderr new file mode 100644 index 000000000..168ececac --- /dev/null +++ b/tests/ui/issues/issue-6458-4.stderr @@ -0,0 +1,16 @@ +error[E0308]: mismatched types + --> $DIR/issue-6458-4.rs:1:20 + | +LL | fn foo(b: bool) -> Result<bool,String> { + | --- ^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression +LL | Err("bar".to_string()); + | - help: remove this semicolon to return this value + | + = note: expected enum `Result<bool, String>` + found unit type `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-6458.rs b/tests/ui/issues/issue-6458.rs new file mode 100644 index 000000000..16718e90d --- /dev/null +++ b/tests/ui/issues/issue-6458.rs @@ -0,0 +1,14 @@ +use std::marker; + +pub struct TypeWithState<State>(marker::PhantomData<State>); +pub struct MyState; + +pub fn foo<State>(_: TypeWithState<State>) {} + +pub fn bar() { + foo(TypeWithState(marker::PhantomData)); + //~^ ERROR type annotations needed [E0282] +} + +fn main() { +} diff --git a/tests/ui/issues/issue-6458.stderr b/tests/ui/issues/issue-6458.stderr new file mode 100644 index 000000000..2e93c1385 --- /dev/null +++ b/tests/ui/issues/issue-6458.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-6458.rs:9:22 + | +LL | foo(TypeWithState(marker::PhantomData)); + | ^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `PhantomData` + | +help: consider specifying the generic argument + | +LL | foo(TypeWithState(marker::PhantomData::<T>)); + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-64593.rs b/tests/ui/issues/issue-64593.rs new file mode 100644 index 000000000..9e787f638 --- /dev/null +++ b/tests/ui/issues/issue-64593.rs @@ -0,0 +1,12 @@ +// check-pass +#![deny(improper_ctypes)] + +pub struct Error(std::num::NonZeroU32); + +extern "Rust" { + fn foo(dest: &mut [u8]) -> Result<(), Error>; +} + +fn main() { + let _ = unsafe { foo(&mut []) }; +} diff --git a/tests/ui/issues/issue-64792-bad-unicode-ctor.rs b/tests/ui/issues/issue-64792-bad-unicode-ctor.rs new file mode 100644 index 000000000..f1427ef46 --- /dev/null +++ b/tests/ui/issues/issue-64792-bad-unicode-ctor.rs @@ -0,0 +1,5 @@ +struct X {} + +const Y: X = X("ö"); //~ ERROR expected function, tuple struct or tuple variant, found struct `X` + +fn main() {} diff --git a/tests/ui/issues/issue-64792-bad-unicode-ctor.stderr b/tests/ui/issues/issue-64792-bad-unicode-ctor.stderr new file mode 100644 index 000000000..2ec151d24 --- /dev/null +++ b/tests/ui/issues/issue-64792-bad-unicode-ctor.stderr @@ -0,0 +1,12 @@ +error[E0423]: expected function, tuple struct or tuple variant, found struct `X` + --> $DIR/issue-64792-bad-unicode-ctor.rs:3:14 + | +LL | struct X {} + | ----------- `X` defined here +LL | +LL | const Y: X = X("ö"); + | ^^^^^^ help: use struct literal syntax instead: `X {}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0423`. diff --git a/tests/ui/issues/issue-65131.rs b/tests/ui/issues/issue-65131.rs new file mode 100644 index 000000000..8b5345da9 --- /dev/null +++ b/tests/ui/issues/issue-65131.rs @@ -0,0 +1,18 @@ +fn get_pair(_a: &mut u32, _b: &mut u32) {} + +macro_rules! x10 { + ($($t:tt)*) => { + $($t)* $($t)* $($t)* $($t)* $($t)* + $($t)* $($t)* $($t)* $($t)* $($t)* + } +} + +#[allow(unused_assignments)] +fn main() { + let mut x = 1; + + get_pair(&mut x, &mut x); + //~^ ERROR: cannot borrow `x` as mutable more than once at a time + + x10! { x10!{ x10!{ if x > 0 { x += 2 } else { x += 1 } } } } +} diff --git a/tests/ui/issues/issue-65131.stderr b/tests/ui/issues/issue-65131.stderr new file mode 100644 index 000000000..e234e6da5 --- /dev/null +++ b/tests/ui/issues/issue-65131.stderr @@ -0,0 +1,12 @@ +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/issue-65131.rs:14:22 + | +LL | get_pair(&mut x, &mut x); + | -------- ------ ^^^^^^ second mutable borrow occurs here + | | | + | | first mutable borrow occurs here + | first borrow later used by call + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/issues/issue-65230.rs b/tests/ui/issues/issue-65230.rs new file mode 100644 index 000000000..54141d221 --- /dev/null +++ b/tests/ui/issues/issue-65230.rs @@ -0,0 +1,11 @@ +trait T0 {} +trait T1: T0 {} + +trait T2 {} + +impl<'a> T0 for &'a (dyn T2 + 'static) {} + +impl T1 for &dyn T2 {} +//~^ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/issues/issue-65230.stderr b/tests/ui/issues/issue-65230.stderr new file mode 100644 index 000000000..7ccab8894 --- /dev/null +++ b/tests/ui/issues/issue-65230.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-65230.rs:8:13 + | +LL | impl T1 for &dyn T2 {} + | ^^^^^^^ lifetime mismatch + | + = note: expected trait `<&dyn T2 as T0>` + found trait `<&(dyn T2 + 'static) as T0>` +note: the anonymous lifetime as defined here... + --> $DIR/issue-65230.rs:8:13 + | +LL | impl T1 for &dyn T2 {} + | ^ + = note: ...does not necessarily outlive the static lifetime + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-65462.rs b/tests/ui/issues/issue-65462.rs new file mode 100644 index 000000000..8c39ea531 --- /dev/null +++ b/tests/ui/issues/issue-65462.rs @@ -0,0 +1,15 @@ +// build-pass + +enum Empty {} +enum Enum { + Empty( Empty ) +} + +fn foobar() -> Option< Enum > { + let value: Option< Empty > = None; + Some( Enum::Empty( value? ) ) +} + +fn main() { + foobar(); +} diff --git a/tests/ui/issues/issue-6557.rs b/tests/ui/issues/issue-6557.rs new file mode 100644 index 000000000..757e9608f --- /dev/null +++ b/tests/ui/issues/issue-6557.rs @@ -0,0 +1,9 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +#![feature(box_patterns)] + +fn foo(box (_x, _y): Box<(isize, isize)>) {} + +pub fn main() {} diff --git a/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2015.stderr b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2015.stderr new file mode 100644 index 000000000..d0cb16995 --- /dev/null +++ b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2015.stderr @@ -0,0 +1,28 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/issue-65634-raw-ident-suggestion.rs:24:13 + | +LL | r#fn {}.r#struct(); + | ^^^^^^^^ multiple `r#struct` found + | +note: candidate #1 is defined in an impl of the trait `async` for the type `r#fn` + --> $DIR/issue-65634-raw-ident-suggestion.rs:7:5 + | +LL | fn r#struct(&self) { + | ^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn` + --> $DIR/issue-65634-raw-ident-suggestion.rs:13:5 + | +LL | fn r#struct(&self) { + | ^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function for candidate #1 + | +LL | async::r#struct(&r#fn {}); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ +help: disambiguate the associated function for candidate #2 + | +LL | await::r#struct(&r#fn {}); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2018.stderr b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2018.stderr new file mode 100644 index 000000000..a75c1c413 --- /dev/null +++ b/tests/ui/issues/issue-65634-raw-ident-suggestion.edition2018.stderr @@ -0,0 +1,28 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/issue-65634-raw-ident-suggestion.rs:24:13 + | +LL | r#fn {}.r#struct(); + | ^^^^^^^^ multiple `r#struct` found + | +note: candidate #1 is defined in an impl of the trait `r#async` for the type `r#fn` + --> $DIR/issue-65634-raw-ident-suggestion.rs:7:5 + | +LL | fn r#struct(&self) { + | ^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `r#await` for the type `r#fn` + --> $DIR/issue-65634-raw-ident-suggestion.rs:13:5 + | +LL | fn r#struct(&self) { + | ^^^^^^^^^^^^^^^^^^ +help: disambiguate the associated function for candidate #1 + | +LL | r#async::r#struct(&r#fn {}); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +help: disambiguate the associated function for candidate #2 + | +LL | r#await::r#struct(&r#fn {}); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/issues/issue-65634-raw-ident-suggestion.rs b/tests/ui/issues/issue-65634-raw-ident-suggestion.rs new file mode 100644 index 000000000..03dd0340c --- /dev/null +++ b/tests/ui/issues/issue-65634-raw-ident-suggestion.rs @@ -0,0 +1,25 @@ +// revisions: edition2015 edition2018 +//[edition2018]edition:2018 + +#![allow(non_camel_case_types)] + +trait r#async { + fn r#struct(&self) { + println!("async"); + } +} + +trait r#await { + fn r#struct(&self) { + println!("await"); + } +} + +struct r#fn {} + +impl r#async for r#fn {} +impl r#await for r#fn {} + +fn main() { + r#fn {}.r#struct(); //~ ERROR multiple applicable items in scope +} diff --git a/tests/ui/issues/issue-6596-2.rs b/tests/ui/issues/issue-6596-2.rs new file mode 100644 index 000000000..8401c4a9d --- /dev/null +++ b/tests/ui/issues/issue-6596-2.rs @@ -0,0 +1,11 @@ +macro_rules! g { + ($inp:ident) => ( + { $inp $nonexistent } + //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `$` + ); +} + +fn main() { + let foo = 0; + g!(foo); +} diff --git a/tests/ui/issues/issue-6596-2.stderr b/tests/ui/issues/issue-6596-2.stderr new file mode 100644 index 000000000..4fa73a464 --- /dev/null +++ b/tests/ui/issues/issue-6596-2.stderr @@ -0,0 +1,13 @@ +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `$` + --> $DIR/issue-6596-2.rs:3:16 + | +LL | { $inp $nonexistent } + | ^^^^^^^^^^^^ expected one of 8 possible tokens +... +LL | g!(foo); + | ------- in this macro invocation + | + = note: this error originates in the macro `g` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-66308.rs b/tests/ui/issues/issue-66308.rs new file mode 100644 index 000000000..8460b359a --- /dev/null +++ b/tests/ui/issues/issue-66308.rs @@ -0,0 +1,8 @@ +// build-pass +// compile-flags: --crate-type lib -C opt-level=0 + +// Regression test for LLVM crash affecting Emscripten targets + +pub fn foo() { + (0..0).rev().next(); +} diff --git a/tests/ui/issues/issue-66353.rs b/tests/ui/issues/issue-66353.rs new file mode 100644 index 000000000..d8abdd520 --- /dev/null +++ b/tests/ui/issues/issue-66353.rs @@ -0,0 +1,15 @@ +// #66353: ICE when trying to recover from incorrect associated type + +trait _Func<T> { + fn func(_: Self); +} + +trait _A { + type AssocT; +} + +fn main() { + _Func::< <() as _A>::AssocT >::func(()); + //~^ ERROR the trait bound `(): _A` is not satisfied + //~| ERROR the trait bound `(): _Func<_>` is not satisfied +} diff --git a/tests/ui/issues/issue-66353.stderr b/tests/ui/issues/issue-66353.stderr new file mode 100644 index 000000000..335618097 --- /dev/null +++ b/tests/ui/issues/issue-66353.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `(): _A` is not satisfied + --> $DIR/issue-66353.rs:12:14 + | +LL | _Func::< <() as _A>::AssocT >::func(()); + | ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()` + +error[E0277]: the trait bound `(): _Func<_>` is not satisfied + --> $DIR/issue-66353.rs:12:41 + | +LL | _Func::< <() as _A>::AssocT >::func(()); + | ----------------------------------- ^^ the trait `_Func<_>` is not implemented for `()` + | | + | required by a bound introduced by this call + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-6642.rs b/tests/ui/issues/issue-6642.rs new file mode 100644 index 000000000..f80f6fffe --- /dev/null +++ b/tests/ui/issues/issue-6642.rs @@ -0,0 +1,9 @@ +struct A; +impl A { + fn m(&self) { + fn x() { + self.m() //~ ERROR can't capture dynamic environment in a fn item + } + } +} +fn main() {} diff --git a/tests/ui/issues/issue-6642.stderr b/tests/ui/issues/issue-6642.stderr new file mode 100644 index 000000000..6668108d0 --- /dev/null +++ b/tests/ui/issues/issue-6642.stderr @@ -0,0 +1,11 @@ +error[E0434]: can't capture dynamic environment in a fn item + --> $DIR/issue-6642.rs:5:13 + | +LL | self.m() + | ^^^^ + | + = help: use the `|| { ... }` closure form instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0434`. diff --git a/tests/ui/issues/issue-66667-function-cmp-cycle.rs b/tests/ui/issues/issue-66667-function-cmp-cycle.rs new file mode 100644 index 000000000..7b025be11 --- /dev/null +++ b/tests/ui/issues/issue-66667-function-cmp-cycle.rs @@ -0,0 +1,16 @@ +fn first() { + second == 1 //~ ERROR binary operation + //~^ ERROR mismatched types +} + +fn second() { + first == 1 //~ ERROR binary operation + //~^ ERROR mismatched types +} + +fn bar() { + bar == 1 //~ ERROR binary operation + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr new file mode 100644 index 000000000..887699ef5 --- /dev/null +++ b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr @@ -0,0 +1,55 @@ +error[E0369]: binary operation `==` cannot be applied to type `fn() {second}` + --> $DIR/issue-66667-function-cmp-cycle.rs:2:12 + | +LL | second == 1 + | ------ ^^ - {integer} + | | + | fn() {second} + +error[E0308]: mismatched types + --> $DIR/issue-66667-function-cmp-cycle.rs:2:15 + | +LL | second == 1 + | ^ expected fn item, found integer + | + = note: expected fn item `fn() {second}` + found type `{integer}` + +error[E0369]: binary operation `==` cannot be applied to type `fn() {first}` + --> $DIR/issue-66667-function-cmp-cycle.rs:7:11 + | +LL | first == 1 + | ----- ^^ - {integer} + | | + | fn() {first} + +error[E0308]: mismatched types + --> $DIR/issue-66667-function-cmp-cycle.rs:7:14 + | +LL | first == 1 + | ^ expected fn item, found integer + | + = note: expected fn item `fn() {first}` + found type `{integer}` + +error[E0369]: binary operation `==` cannot be applied to type `fn() {bar}` + --> $DIR/issue-66667-function-cmp-cycle.rs:12:9 + | +LL | bar == 1 + | --- ^^ - {integer} + | | + | fn() {bar} + +error[E0308]: mismatched types + --> $DIR/issue-66667-function-cmp-cycle.rs:12:12 + | +LL | bar == 1 + | ^ expected fn item, found integer + | + = note: expected fn item `fn() {bar}` + found type `{integer}` + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0308, E0369. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-66702-break-outside-loop-val.rs b/tests/ui/issues/issue-66702-break-outside-loop-val.rs new file mode 100644 index 000000000..05b86cbbf --- /dev/null +++ b/tests/ui/issues/issue-66702-break-outside-loop-val.rs @@ -0,0 +1,9 @@ +// Breaks with values inside closures used to ICE (#66863) + +fn main() { + 'some_label: loop { + || break 'some_label (); + //~^ ERROR: use of unreachable label `'some_label` + //~| ERROR: `break` inside of a closure + } +} diff --git a/tests/ui/issues/issue-66702-break-outside-loop-val.stderr b/tests/ui/issues/issue-66702-break-outside-loop-val.stderr new file mode 100644 index 000000000..f92ede311 --- /dev/null +++ b/tests/ui/issues/issue-66702-break-outside-loop-val.stderr @@ -0,0 +1,22 @@ +error[E0767]: use of unreachable label `'some_label` + --> $DIR/issue-66702-break-outside-loop-val.rs:5:18 + | +LL | 'some_label: loop { + | ----------- unreachable label defined here +LL | || break 'some_label (); + | ^^^^^^^^^^^ unreachable label `'some_label` + | + = note: labels are unreachable through functions, closures, async blocks and modules + +error[E0267]: `break` inside of a closure + --> $DIR/issue-66702-break-outside-loop-val.rs:5:12 + | +LL | || break 'some_label (); + | -- ^^^^^^^^^^^^^^^^^^^^ cannot `break` inside of a closure + | | + | enclosing closure + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0267, E0767. +For more information about an error, try `rustc --explain E0267`. diff --git a/tests/ui/issues/issue-66706.rs b/tests/ui/issues/issue-66706.rs new file mode 100644 index 000000000..835fdfae8 --- /dev/null +++ b/tests/ui/issues/issue-66706.rs @@ -0,0 +1,22 @@ +fn a() { + [0; [|_: _ &_| ()].len()] + //~^ ERROR expected `,`, found `&` + //~| ERROR type annotations needed +} + +fn b() { + [0; [|f @ &ref _| {} ; 0 ].len() ]; + //~^ ERROR expected identifier, found reserved identifier `_` +} + +fn c() { + [0; [|&_: _ &_| {}; 0 ].len()] + //~^ ERROR expected `,`, found `&` +} + +fn d() { + [0; match [|f @ &ref _| () ] {} ] + //~^ ERROR expected identifier, found reserved identifier `_` +} + +fn main() {} diff --git a/tests/ui/issues/issue-66706.stderr b/tests/ui/issues/issue-66706.stderr new file mode 100644 index 000000000..8a30c0cad --- /dev/null +++ b/tests/ui/issues/issue-66706.stderr @@ -0,0 +1,37 @@ +error: expected `,`, found `&` + --> $DIR/issue-66706.rs:2:16 + | +LL | [0; [|_: _ &_| ()].len()] + | -^ expected `,` + | | + | help: missing `,` + +error: expected identifier, found reserved identifier `_` + --> $DIR/issue-66706.rs:8:20 + | +LL | [0; [|f @ &ref _| {} ; 0 ].len() ]; + | ^ expected identifier, found reserved identifier + +error: expected `,`, found `&` + --> $DIR/issue-66706.rs:13:17 + | +LL | [0; [|&_: _ &_| {}; 0 ].len()] + | -^ expected `,` + | | + | help: missing `,` + +error: expected identifier, found reserved identifier `_` + --> $DIR/issue-66706.rs:18:26 + | +LL | [0; match [|f @ &ref _| () ] {} ] + | ^ expected identifier, found reserved identifier + +error[E0282]: type annotations needed + --> $DIR/issue-66706.rs:2:11 + | +LL | [0; [|_: _ &_| ()].len()] + | ^ cannot infer type + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-66768.rs b/tests/ui/issues/issue-66768.rs new file mode 100644 index 000000000..ce42c8b01 --- /dev/null +++ b/tests/ui/issues/issue-66768.rs @@ -0,0 +1,205 @@ +// Regression test for #66768. +// check-pass +#![allow(dead_code)] +//-^ "dead code" is needed to reproduce the issue. + +use std::marker::PhantomData; +use std::ops::{Add, Mul}; + +fn problematic_function<Space>(material_surface_element: Edge2dElement) +where + DefaultAllocator: FiniteElementAllocator<DimU1, Space>, +{ + let _: Point2<f64> = material_surface_element.map_reference_coords().into(); +} + +impl<T> ArrayLength<T> for UTerm { + type ArrayType = (); +} +impl<T, N: ArrayLength<T>> ArrayLength<T> for UInt<N, B0> { + type ArrayType = GenericArrayImplEven<T, N>; +} +impl<T, N: ArrayLength<T>> ArrayLength<T> for UInt<N, B1> { + type ArrayType = GenericArrayImplOdd<T, N>; +} +impl<U> Add<U> for UTerm { + type Output = U; + fn add(self, _: U) -> Self::Output { + unimplemented!() + } +} +impl<Ul, Ur> Add<UInt<Ur, B1>> for UInt<Ul, B0> +where + Ul: Add<Ur>, +{ + type Output = UInt<Sum<Ul, Ur>, B1>; + fn add(self, _: UInt<Ur, B1>) -> Self::Output { + unimplemented!() + } +} +impl<U> Mul<U> for UTerm { + type Output = UTerm; + fn mul(self, _: U) -> Self { + unimplemented!() + } +} +impl<Ul, B, Ur> Mul<UInt<Ur, B>> for UInt<Ul, B0> +where + Ul: Mul<UInt<Ur, B>>, +{ + type Output = UInt<Prod<Ul, UInt<Ur, B>>, B0>; + fn mul(self, _: UInt<Ur, B>) -> Self::Output { + unimplemented!() + } +} +impl<Ul, B, Ur> Mul<UInt<Ur, B>> for UInt<Ul, B1> +where + Ul: Mul<UInt<Ur, B>>, + UInt<Prod<Ul, UInt<Ur, B>>, B0>: Add<UInt<Ur, B>>, +{ + type Output = Sum<UInt<Prod<Ul, UInt<Ur, B>>, B0>, UInt<Ur, B>>; + fn mul(self, _: UInt<Ur, B>) -> Self::Output { + unimplemented!() + } +} +impl<N, R, C> Allocator<N, R, C> for DefaultAllocator +where + R: DimName, + C: DimName, + R::Value: Mul<C::Value>, + Prod<R::Value, C::Value>: ArrayLength<N>, +{ + type Buffer = ArrayStorage<N, R, C>; + fn allocate_uninitialized(_: R, _: C) -> Self::Buffer { + unimplemented!() + } + fn allocate_from_iterator<I>(_: R, _: C, _: I) -> Self::Buffer { + unimplemented!() + } +} +impl<N, C> Allocator<N, Dynamic, C> for DefaultAllocator { + type Buffer = VecStorage<N, Dynamic, C>; + fn allocate_uninitialized(_: Dynamic, _: C) -> Self::Buffer { + unimplemented!() + } + fn allocate_from_iterator<I>(_: Dynamic, _: C, _: I) -> Self::Buffer { + unimplemented!() + } +} +impl DimName for DimU1 { + type Value = U1; + fn name() -> Self { + unimplemented!() + } +} +impl DimName for DimU2 { + type Value = U2; + fn name() -> Self { + unimplemented!() + } +} +impl<N, D> From<VectorN<N, D>> for Point<N, D> +where + DefaultAllocator: Allocator<N, D>, +{ + fn from(_: VectorN<N, D>) -> Self { + unimplemented!() + } +} +impl<GeometryDim, NodalDim> FiniteElementAllocator<GeometryDim, NodalDim> for DefaultAllocator where + DefaultAllocator: Allocator<f64, GeometryDim> + Allocator<f64, NodalDim> +{ +} +impl ReferenceFiniteElement for Edge2dElement { + type NodalDim = DimU1; +} +impl FiniteElement<DimU2> for Edge2dElement { + fn map_reference_coords(&self) -> Vector2<f64> { + unimplemented!() + } +} + +type Owned<N, R, C> = <DefaultAllocator as Allocator<N, R, C>>::Buffer; +type MatrixMN<N, R, C> = Matrix<N, R, C, Owned<N, R, C>>; +type VectorN<N, D> = MatrixMN<N, D, DimU1>; +type Vector2<N> = VectorN<N, DimU2>; +type Point2<N> = Point<N, DimU2>; +type U1 = UInt<UTerm, B1>; +type U2 = UInt<UInt<UTerm, B1>, B0>; +type Sum<A, B> = <A as Add<B>>::Output; +type Prod<A, B> = <A as Mul<B>>::Output; + +struct GenericArray<T, U: ArrayLength<T>> { + _data: U::ArrayType, +} +struct GenericArrayImplEven<T, U> { + _parent2: U, + _marker: T, +} +struct GenericArrayImplOdd<T, U> { + _parent2: U, + _data: T, +} +struct B0; +struct B1; +struct UTerm; +struct UInt<U, B> { + _marker: PhantomData<(U, B)>, +} +struct DefaultAllocator; +struct Dynamic; +struct DimU1; +struct DimU2; +struct Matrix<N, R, C, S> { + _data: S, + _phantoms: PhantomData<(N, R, C)>, +} +struct ArrayStorage<N, R, C> +where + R: DimName, + C: DimName, + R::Value: Mul<C::Value>, + Prod<R::Value, C::Value>: ArrayLength<N>, +{ + _data: GenericArray<N, Prod<R::Value, C::Value>>, +} +struct VecStorage<N, R, C> { + _data: N, + _nrows: R, + _ncols: C, +} +struct Point<N, D> +where + DefaultAllocator: Allocator<N, D>, +{ + _coords: VectorN<N, D>, +} +struct Edge2dElement; + +trait ArrayLength<T> { + type ArrayType; +} +trait Allocator<Scalar, R, C = DimU1> { + type Buffer; + fn allocate_uninitialized(nrows: R, ncols: C) -> Self::Buffer; + fn allocate_from_iterator<I>(nrows: R, ncols: C, iter: I) -> Self::Buffer; +} +trait DimName { + type Value; + fn name() -> Self; +} +trait FiniteElementAllocator<GeometryDim, NodalDim>: + Allocator<f64, GeometryDim> + Allocator<f64, NodalDim> +{ +} +trait ReferenceFiniteElement { + type NodalDim; +} +trait FiniteElement<GeometryDim>: ReferenceFiniteElement +where + DefaultAllocator: FiniteElementAllocator<GeometryDim, Self::NodalDim>, +{ + fn map_reference_coords(&self) -> VectorN<f64, GeometryDim>; +} + +fn main() {} diff --git a/tests/ui/issues/issue-66923-show-error-for-correct-call.rs b/tests/ui/issues/issue-66923-show-error-for-correct-call.rs new file mode 100644 index 000000000..833280739 --- /dev/null +++ b/tests/ui/issues/issue-66923-show-error-for-correct-call.rs @@ -0,0 +1,15 @@ +// This test checks that errors are showed for lines with `collect` rather than `push` method. + +fn main() { + let v = vec![1_f64, 2.2_f64]; + let mut fft: Vec<Vec<f64>> = vec![]; + + let x1: &[f64] = &v; + let x2: Vec<f64> = x1.into_iter().collect(); + //~^ ERROR a value of type + fft.push(x2); + + let x3 = x1.into_iter().collect::<Vec<f64>>(); + //~^ ERROR a value of type + fft.push(x3); +} diff --git a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr new file mode 100644 index 000000000..cec482a53 --- /dev/null +++ b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -0,0 +1,40 @@ +error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64` + --> $DIR/issue-66923-show-error-for-correct-call.rs:8:39 + | +LL | let x2: Vec<f64> = x1.into_iter().collect(); + | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` + | + = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` + = help: the trait `FromIterator<T>` is implemented for `Vec<T>` +note: the method call chain might not have had the expected associated types + --> $DIR/issue-66923-show-error-for-correct-call.rs:8:27 + | +LL | let x1: &[f64] = &v; + | -- this expression has type `&Vec<f64>` +LL | let x2: Vec<f64> = x1.into_iter().collect(); + | ^^^^^^^^^^^ `Iterator::Item` is `&f64` here +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64` + --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29 + | +LL | let x3 = x1.into_iter().collect::<Vec<f64>>(); + | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` + | + = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` + = help: the trait `FromIterator<T>` is implemented for `Vec<T>` +note: the method call chain might not have had the expected associated types + --> $DIR/issue-66923-show-error-for-correct-call.rs:12:17 + | +LL | let x1: &[f64] = &v; + | -- this expression has type `&Vec<f64>` +... +LL | let x3 = x1.into_iter().collect::<Vec<f64>>(); + | ^^^^^^^^^^^ `Iterator::Item` is `&f64` here +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-67039-unsound-pin-partialeq.rs b/tests/ui/issues/issue-67039-unsound-pin-partialeq.rs new file mode 100644 index 000000000..a496e58a7 --- /dev/null +++ b/tests/ui/issues/issue-67039-unsound-pin-partialeq.rs @@ -0,0 +1,27 @@ +// Pin's PartialEq implementation allowed to access the pointer allowing for +// unsoundness by using Rc::get_mut to move value within Rc. +// See https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73 for more details. + +use std::ops::Deref; +use std::pin::Pin; +use std::rc::Rc; + +struct Apple; + +impl Deref for Apple { + type Target = Apple; + fn deref(&self) -> &Apple { + &Apple + } +} + +impl PartialEq<Rc<Apple>> for Apple { + fn eq(&self, _rc: &Rc<Apple>) -> bool { + unreachable!() + } +} + +fn main() { + let _ = Pin::new(Apple) == Rc::pin(Apple); + //~^ ERROR type mismatch resolving +} diff --git a/tests/ui/issues/issue-67039-unsound-pin-partialeq.stderr b/tests/ui/issues/issue-67039-unsound-pin-partialeq.stderr new file mode 100644 index 000000000..37e2c3bdd --- /dev/null +++ b/tests/ui/issues/issue-67039-unsound-pin-partialeq.stderr @@ -0,0 +1,13 @@ +error[E0271]: type mismatch resolving `<Rc<Apple> as Deref>::Target == Rc<Apple>` + --> $DIR/issue-67039-unsound-pin-partialeq.rs:25:29 + | +LL | let _ = Pin::new(Apple) == Rc::pin(Apple); + | ^^ expected struct `Apple`, found struct `Rc` + | + = note: expected struct `Apple` + found struct `Rc<Apple>` + = note: required for `Pin<Apple>` to implement `PartialEq<Pin<Rc<Apple>>>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/issues/issue-6738.rs b/tests/ui/issues/issue-6738.rs new file mode 100644 index 000000000..a2f8dfe9c --- /dev/null +++ b/tests/ui/issues/issue-6738.rs @@ -0,0 +1,10 @@ +struct Foo<T> { + x: T, +} +impl<T> Foo<T> { + fn add(&mut self, v: Foo<T>){ + self.x += v.x; + //~^ ERROR: binary assignment operation `+=` cannot be applied + } +} +fn main() {} diff --git a/tests/ui/issues/issue-6738.stderr b/tests/ui/issues/issue-6738.stderr new file mode 100644 index 000000000..f97d899c2 --- /dev/null +++ b/tests/ui/issues/issue-6738.stderr @@ -0,0 +1,16 @@ +error[E0368]: binary assignment operation `+=` cannot be applied to type `T` + --> $DIR/issue-6738.rs:6:9 + | +LL | self.x += v.x; + | ------^^^^^^^ + | | + | cannot use `+=` on type `T` + | +help: consider restricting type parameter `T` + | +LL | impl<T: std::ops::AddAssign> Foo<T> { + | +++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0368`. diff --git a/tests/ui/issues/issue-67535.rs b/tests/ui/issues/issue-67535.rs new file mode 100644 index 000000000..24f506213 --- /dev/null +++ b/tests/ui/issues/issue-67535.rs @@ -0,0 +1,22 @@ +fn main() {} + +impl std::ops::AddAssign for () { + //~^ ERROR only traits defined in the current crate can be implemented for arbitrary types + fn add_assign(&self, other: ()) -> () { + () + } +} + +impl std::ops::AddAssign for [(); 1] { + //~^ ERROR only traits defined in the current crate can be implemented for arbitrary types + fn add_assign(&self, other: [(); 1]) -> [(); 1] { + [()] + } +} + +impl std::ops::AddAssign for &[u8] { + //~^ ERROR only traits defined in the current crate can be implemented for arbitrary types + fn add_assign(&self, other: &[u8]) -> &[u8] { + self + } +} diff --git a/tests/ui/issues/issue-67535.stderr b/tests/ui/issues/issue-67535.stderr new file mode 100644 index 000000000..4d7a02a50 --- /dev/null +++ b/tests/ui/issues/issue-67535.stderr @@ -0,0 +1,39 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/issue-67535.rs:3:1 + | +LL | impl std::ops::AddAssign for () { + | ^^^^^-------------------^^^^^-- + | | | | + | | | this is not defined in the current crate because tuples are always foreign + | | this is not defined in the current crate because this is a foreign trait + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/issue-67535.rs:10:1 + | +LL | impl std::ops::AddAssign for [(); 1] { + | ^^^^^-------------------^^^^^------- + | | | | + | | | this is not defined in the current crate because arrays are always foreign + | | this is not defined in the current crate because this is a foreign trait + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/issue-67535.rs:17:1 + | +LL | impl std::ops::AddAssign for &[u8] { + | ^^^^^-------------------^^^^^----- + | | | | + | | | this is not defined in the current crate because slices are always foreign + | | this is not defined in the current crate because this is a foreign trait + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0117`. diff --git a/tests/ui/issues/issue-67552.polonius.stderr b/tests/ui/issues/issue-67552.polonius.stderr new file mode 100644 index 000000000..9ab77d344 --- /dev/null +++ b/tests/ui/issues/issue-67552.polonius.stderr @@ -0,0 +1,17 @@ +error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &... &mut &mut &mut &mut &mut Empty>` + --> $DIR/issue-67552.rs:28:9 + | +LL | rec(identity(&mut it)) + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `rec` defined here + --> $DIR/issue-67552.rs:21:1 + | +LL | / fn rec<T>(mut it: T) +LL | | where +LL | | T: Iterator, + | |________________^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552.polonius/issue-67552.long-type.txt' + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-67552.rs b/tests/ui/issues/issue-67552.rs new file mode 100644 index 000000000..ec1997ccd --- /dev/null +++ b/tests/ui/issues/issue-67552.rs @@ -0,0 +1,32 @@ +// build-fail +// compile-flags: -Copt-level=0 +// normalize-stderr-test: ".nll/" -> "/" + +fn main() { + rec(Empty); +} + +struct Empty; + +impl Iterator for Empty { + type Item = (); + fn next<'a>(&'a mut self) -> core::option::Option<()> { + None + } +} + +fn identity<T>(x: T) -> T { + x +} + +fn rec<T>(mut it: T) +where + T: Iterator, +{ + if () == () { + T::count(it); + } else { + rec(identity(&mut it)) + //~^ ERROR reached the recursion limit while instantiating + } +} diff --git a/tests/ui/issues/issue-67552.stderr b/tests/ui/issues/issue-67552.stderr new file mode 100644 index 000000000..4746f918b --- /dev/null +++ b/tests/ui/issues/issue-67552.stderr @@ -0,0 +1,17 @@ +error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>` + --> $DIR/issue-67552.rs:29:9 + | +LL | rec(identity(&mut it)) + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `rec` defined here + --> $DIR/issue-67552.rs:22:1 + | +LL | / fn rec<T>(mut it: T) +LL | | where +LL | | T: Iterator, + | |________________^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552/issue-67552.long-type.txt' + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-68010-large-zst-consts.rs b/tests/ui/issues/issue-68010-large-zst-consts.rs new file mode 100644 index 000000000..3277df69c --- /dev/null +++ b/tests/ui/issues/issue-68010-large-zst-consts.rs @@ -0,0 +1,5 @@ +// build-pass + +fn main() { + println!("{}", [(); usize::MAX].len()); +} diff --git a/tests/ui/issues/issue-68696-catch-during-unwind.rs b/tests/ui/issues/issue-68696-catch-during-unwind.rs new file mode 100644 index 000000000..2b12a62d0 --- /dev/null +++ b/tests/ui/issues/issue-68696-catch-during-unwind.rs @@ -0,0 +1,25 @@ +// Checks that catch_unwind can be used if unwinding is already in progress. +// Used to fail when standard library had been compiled with debug assertions, +// due to incorrect assumption that a current thread is not panicking when +// entering the catch_unwind. +// +// run-pass + +use std::panic::catch_unwind; + +#[derive(Default)] +struct Guard; + +impl Drop for Guard { + fn drop(&mut self) { + let _ = catch_unwind(|| {}); + } +} + +fn main() { + #[cfg(panic = "unwind")] + let _ = catch_unwind(|| { + let _guard = Guard::default(); + panic!(); + }); +} diff --git a/tests/ui/issues/issue-6892.rs b/tests/ui/issues/issue-6892.rs new file mode 100644 index 000000000..a361461a4 --- /dev/null +++ b/tests/ui/issues/issue-6892.rs @@ -0,0 +1,58 @@ +// run-pass +#![allow(dead_code)] +// Ensures that destructors are run for expressions of the form "let _ = e;" +// where `e` is a type which requires a destructor. + + +struct Foo; +struct Bar { x: isize } +struct Baz(isize); +enum FooBar { _Foo(Foo), _Bar(usize) } + +static mut NUM_DROPS: usize = 0; + +impl Drop for Foo { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} +impl Drop for Bar { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} +impl Drop for Baz { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} +impl Drop for FooBar { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +fn main() { + assert_eq!(unsafe { NUM_DROPS }, 0); + { let _x = Foo; } + assert_eq!(unsafe { NUM_DROPS }, 1); + { let _x = Bar { x: 21 }; } + assert_eq!(unsafe { NUM_DROPS }, 2); + { let _x = Baz(21); } + assert_eq!(unsafe { NUM_DROPS }, 3); + { let _x = FooBar::_Foo(Foo); } + assert_eq!(unsafe { NUM_DROPS }, 5); + { let _x = FooBar::_Bar(42); } + assert_eq!(unsafe { NUM_DROPS }, 6); + + { let _ = Foo; } + assert_eq!(unsafe { NUM_DROPS }, 7); + { let _ = Bar { x: 21 }; } + assert_eq!(unsafe { NUM_DROPS }, 8); + { let _ = Baz(21); } + assert_eq!(unsafe { NUM_DROPS }, 9); + { let _ = FooBar::_Foo(Foo); } + assert_eq!(unsafe { NUM_DROPS }, 11); + { let _ = FooBar::_Bar(42); } + assert_eq!(unsafe { NUM_DROPS }, 12); +} diff --git a/tests/ui/issues/issue-68951.rs b/tests/ui/issues/issue-68951.rs new file mode 100644 index 000000000..1c1e92c5b --- /dev/null +++ b/tests/ui/issues/issue-68951.rs @@ -0,0 +1,9 @@ +// check-pass + +fn main() { + let array = [0x42u8; 10]; + for b in &array { + let lo = b & 0xf; + let hi = (b >> 4) & 0xf; + } +} diff --git a/tests/ui/issues/issue-6898.rs b/tests/ui/issues/issue-6898.rs new file mode 100644 index 000000000..44fd4bd07 --- /dev/null +++ b/tests/ui/issues/issue-6898.rs @@ -0,0 +1,33 @@ +// check-pass +// pretty-expanded FIXME #23616 + +use std::mem; + +/// Returns the size of a type +pub fn size_of<T>() -> usize { + TypeInfo::size_of(None::<T>) +} + +/// Returns the size of the type that `val` points to +pub fn size_of_val<T>(val: &T) -> usize { + val.size_of_val() +} + +pub trait TypeInfo: Sized { + fn size_of(_lame_type_hint: Option<Self>) -> usize; + fn size_of_val(&self) -> usize; +} + +impl<T> TypeInfo for T { + /// The size of the type in bytes. + fn size_of(_lame_type_hint: Option<T>) -> usize { + mem::size_of::<T>() + } + + /// Returns the size of the type of `self` in bytes. + fn size_of_val(&self) -> usize { + TypeInfo::size_of(None::<T>) + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-69130.rs b/tests/ui/issues/issue-69130.rs new file mode 100644 index 000000000..9552e8ec2 --- /dev/null +++ b/tests/ui/issues/issue-69130.rs @@ -0,0 +1,7 @@ +// Issue 69130: character indexing bug in rustc_errors::CodeSuggestion::splice_lines(). + +enum F { +M (§& u8)} +//~^ ERROR unknown start of token +//~| missing lifetime specifier +fn main() {} diff --git a/tests/ui/issues/issue-69130.stderr b/tests/ui/issues/issue-69130.stderr new file mode 100644 index 000000000..e67cc295d --- /dev/null +++ b/tests/ui/issues/issue-69130.stderr @@ -0,0 +1,21 @@ +error: unknown start of token: \u{a7} + --> $DIR/issue-69130.rs:4:4 + | +LL | M (§& u8)} + | ^ + +error[E0106]: missing lifetime specifier + --> $DIR/issue-69130.rs:4:5 + | +LL | M (§& u8)} + | ^ expected named lifetime parameter + | +help: consider introducing a named lifetime parameter + | +LL ~ enum F<'a> { +LL ~ M (§&'a u8)} + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/issues/issue-6919.rs b/tests/ui/issues/issue-6919.rs new file mode 100644 index 000000000..6f1e1f977 --- /dev/null +++ b/tests/ui/issues/issue-6919.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(unused_attributes)] +// aux-build:iss.rs + +// pretty-expanded FIXME #23616 + +extern crate issue6919_3; + +pub fn main() { + let _ = issue6919_3::D.k; +} diff --git a/tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs b/tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs new file mode 100644 index 000000000..6e030f1cc --- /dev/null +++ b/tests/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs @@ -0,0 +1,33 @@ +// run-fail +// compile-flags: -C opt-level=3 +// error-pattern: index out of bounds: the len is 0 but the index is 16777216 +// ignore-wasm no panic or subprocess support +// ignore-emscripten no panic or subprocess support + +fn do_test(x: usize) { + let mut arr = vec![vec![0u8; 3]]; + + let mut z = vec![0]; + for arr_ref in arr.iter_mut() { + for y in 0..x { + for _ in 0..1 { + z.reserve_exact(x); + let iterator = std::iter::repeat(0).take(x); + let mut cnt = 0; + iterator.for_each(|_| { + z[0] = 0; + cnt += 1; + }); + let a = y * x; + let b = (y + 1) * x - 1; + let slice = &mut arr_ref[a..b]; + slice[1 << 24] += 1; + } + } + } +} + +fn main() { + do_test(1); + do_test(2); +} diff --git a/tests/ui/issues/issue-69225-layout-repeated-checked-add.rs b/tests/ui/issues/issue-69225-layout-repeated-checked-add.rs new file mode 100644 index 000000000..7f43e4d1a --- /dev/null +++ b/tests/ui/issues/issue-69225-layout-repeated-checked-add.rs @@ -0,0 +1,31 @@ +// Ensure we appropriately error instead of overflowing a calculation when creating a new Alloc +// Layout + +// run-fail +// compile-flags: -C opt-level=3 +// error-pattern: index out of bounds: the len is 0 but the index is 16777216 +// ignore-wasm no panic or subprocess support +// ignore-emscripten no panic or subprocess support + +fn do_test(x: usize) { + let arr = vec![vec![0u8; 3]]; + + let mut z = Vec::new(); + for arr_ref in arr { + for y in 0..x { + for _ in 0..1 { + z.extend(std::iter::repeat(0).take(x)); + let a = y * x; + let b = (y + 1) * x - 1; + let slice = &arr_ref[a..b]; + eprintln!("{} {} {} {}", a, b, arr_ref.len(), slice.len()); + eprintln!("{:?}", slice[1 << 24]); + } + } + } +} + +fn main() { + do_test(1); + do_test(2); +} diff --git a/tests/ui/issues/issue-69306.rs b/tests/ui/issues/issue-69306.rs new file mode 100644 index 000000000..85d60952a --- /dev/null +++ b/tests/ui/issues/issue-69306.rs @@ -0,0 +1,45 @@ +fn main() {} + +struct S0<T>(T); +impl<T> S0<T> { + const C: S0<u8> = Self(0); + //~^ ERROR mismatched types + //~| ERROR mismatched types + + fn foo() { + Self(0); + //~^ ERROR mismatched types + } +} + +// Testing normalization. +trait Fun { + type Out; +} +impl<T> Fun for S0<T> { + type Out = Self; +} +trait Foo<T> { + fn foo(); +} +impl<T> Foo<T> for <S0<T> as Fun>::Out { + fn foo() { + Self(0); //~ ERROR mismatched types + } +} + +struct S1<T, U>(T, U); +impl<T> S1<T, u8> { + const C: S1<u8, u8> = Self(0, 1); + //~^ ERROR mismatched types + //~| ERROR mismatched types +} + +struct S2<T>(T); +impl<T> S2<T> { + fn map<U>(x: U) -> S2<U> { + Self(x) + //~^ ERROR mismatched types + //~| ERROR mismatched types + } +} diff --git a/tests/ui/issues/issue-69306.stderr b/tests/ui/issues/issue-69306.stderr new file mode 100644 index 000000000..61ec5d318 --- /dev/null +++ b/tests/ui/issues/issue-69306.stderr @@ -0,0 +1,138 @@ +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:5:28 + | +LL | impl<T> S0<T> { + | - this type parameter +LL | const C: S0<u8> = Self(0); + | ---- ^ expected type parameter `T`, found integer + | | + | arguments to this function are incorrect + | + = note: expected type parameter `T` + found type `{integer}` +note: tuple struct defined here + --> $DIR/issue-69306.rs:3:8 + | +LL | struct S0<T>(T); + | ^^ + +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:5:23 + | +LL | impl<T> S0<T> { + | - this type parameter +LL | const C: S0<u8> = Self(0); + | ^^^^^^^ expected `u8`, found type parameter `T` + | + = note: expected struct `S0<u8>` + found struct `S0<T>` + +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:10:14 + | +LL | impl<T> S0<T> { + | - this type parameter +... +LL | Self(0); + | ---- ^ expected type parameter `T`, found integer + | | + | arguments to this function are incorrect + | + = note: expected type parameter `T` + found type `{integer}` +note: tuple struct defined here + --> $DIR/issue-69306.rs:3:8 + | +LL | struct S0<T>(T); + | ^^ + +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:27:14 + | +LL | impl<T> Foo<T> for <S0<T> as Fun>::Out { + | - this type parameter +LL | fn foo() { +LL | Self(0); + | ---- ^ expected type parameter `T`, found integer + | | + | arguments to this function are incorrect + | + = note: expected type parameter `T` + found type `{integer}` +note: tuple struct defined here + --> $DIR/issue-69306.rs:3:8 + | +LL | struct S0<T>(T); + | ^^ + +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:33:32 + | +LL | impl<T> S1<T, u8> { + | - this type parameter +LL | const C: S1<u8, u8> = Self(0, 1); + | ---- ^ expected type parameter `T`, found integer + | | + | arguments to this function are incorrect + | + = note: expected type parameter `T` + found type `{integer}` +note: tuple struct defined here + --> $DIR/issue-69306.rs:31:8 + | +LL | struct S1<T, U>(T, U); + | ^^ + +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:33:27 + | +LL | impl<T> S1<T, u8> { + | - this type parameter +LL | const C: S1<u8, u8> = Self(0, 1); + | ^^^^^^^^^^ expected `u8`, found type parameter `T` + | + = note: expected struct `S1<u8, _>` + found struct `S1<T, _>` + +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:41:14 + | +LL | impl<T> S2<T> { + | - expected type parameter +LL | fn map<U>(x: U) -> S2<U> { + | - found type parameter +LL | Self(x) + | ---- ^ expected type parameter `T`, found type parameter `U` + | | + | arguments to this function are incorrect + | + = note: expected type parameter `T` + found type parameter `U` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters +note: tuple struct defined here + --> $DIR/issue-69306.rs:38:8 + | +LL | struct S2<T>(T); + | ^^ + +error[E0308]: mismatched types + --> $DIR/issue-69306.rs:41:9 + | +LL | impl<T> S2<T> { + | - found type parameter +LL | fn map<U>(x: U) -> S2<U> { + | - ----- expected `S2<U>` because of return type + | | + | expected type parameter +LL | Self(x) + | ^^^^^^^ expected type parameter `U`, found type parameter `T` + | + = note: expected struct `S2<U>` + found struct `S2<T>` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-6936.rs b/tests/ui/issues/issue-6936.rs new file mode 100644 index 000000000..26531bba9 --- /dev/null +++ b/tests/ui/issues/issue-6936.rs @@ -0,0 +1,34 @@ +struct T; + +mod t1 { + type Foo = ::T; + mod Foo {} //~ ERROR the name `Foo` is defined multiple times +} + +mod t2 { + type Foo = ::T; + struct Foo; //~ ERROR the name `Foo` is defined multiple times +} + +mod t3 { + type Foo = ::T; + enum Foo {} //~ ERROR the name `Foo` is defined multiple times +} + +mod t4 { + type Foo = ::T; + fn Foo() {} // ok +} + +mod t5 { + type Bar<T> = T; + mod Bar {} //~ ERROR the name `Bar` is defined multiple times +} + +mod t6 { + type Foo = ::T; + impl Foo {} // ok +} + + +fn main() {} diff --git a/tests/ui/issues/issue-6936.stderr b/tests/ui/issues/issue-6936.stderr new file mode 100644 index 000000000..9292d60ca --- /dev/null +++ b/tests/ui/issues/issue-6936.stderr @@ -0,0 +1,43 @@ +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/issue-6936.rs:5:5 + | +LL | type Foo = ::T; + | --------------- previous definition of the type `Foo` here +LL | mod Foo {} + | ^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/issue-6936.rs:10:5 + | +LL | type Foo = ::T; + | --------------- previous definition of the type `Foo` here +LL | struct Foo; + | ^^^^^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/issue-6936.rs:15:5 + | +LL | type Foo = ::T; + | --------------- previous definition of the type `Foo` here +LL | enum Foo {} + | ^^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Bar` is defined multiple times + --> $DIR/issue-6936.rs:25:5 + | +LL | type Bar<T> = T; + | ---------------- previous definition of the type `Bar` here +LL | mod Bar {} + | ^^^^^^^ `Bar` redefined here + | + = note: `Bar` must be defined only once in the type namespace of this module + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-69396-const-no-type-in-macro.rs b/tests/ui/issues/issue-69396-const-no-type-in-macro.rs new file mode 100644 index 000000000..45a308574 --- /dev/null +++ b/tests/ui/issues/issue-69396-const-no-type-in-macro.rs @@ -0,0 +1,17 @@ +macro_rules! suite { + ( $( $fn:ident; )* ) => { + $( + const A = "A".$fn(); + //~^ ERROR the name `A` is defined multiple times + //~| ERROR missing type for `const` item + //~| ERROR the placeholder `_` is not allowed within types on item signatures for constants + )* + } +} + +suite! { + len; + is_empty; +} + +fn main() {} diff --git a/tests/ui/issues/issue-69396-const-no-type-in-macro.stderr b/tests/ui/issues/issue-69396-const-no-type-in-macro.stderr new file mode 100644 index 000000000..89aeafeba --- /dev/null +++ b/tests/ui/issues/issue-69396-const-no-type-in-macro.stderr @@ -0,0 +1,50 @@ +error[E0428]: the name `A` is defined multiple times + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:13 + | +LL | const A = "A".$fn(); + | ^^^^^^^^^^^^^^^^^^^^ `A` redefined here +... +LL | / suite! { +LL | | len; +LL | | is_empty; +LL | | } + | |_- in this macro invocation + | + = note: `A` must be defined only once in the value namespace of this module + = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: missing type for `const` item + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 + | +LL | const A = "A".$fn(); + | ^ help: provide a type for the constant: `: usize` +... +LL | / suite! { +LL | | len; +LL | | is_empty; +LL | | } + | |_- in this macro invocation + | + = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 + | +LL | const A = "A".$fn(); + | ^ + | | + | not allowed in type signatures + | help: replace with the correct type: `bool` +... +LL | / suite! { +LL | | len; +LL | | is_empty; +LL | | } + | |_- in this macro invocation + | + = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0121, E0428. +For more information about an error, try `rustc --explain E0121`. diff --git a/tests/ui/issues/issue-69455.rs b/tests/ui/issues/issue-69455.rs new file mode 100644 index 000000000..a53aadcfa --- /dev/null +++ b/tests/ui/issues/issue-69455.rs @@ -0,0 +1,31 @@ +// Regression test for #69455: projection predicate was not satisfied. +// Compiler should indicate the correct location of the +// unsatisfied projection predicate + +pub trait Test<Rhs = Self> { + type Output; + + fn test(self, rhs: Rhs) -> Self::Output; +} + +impl Test<u32> for u64 { + type Output = u64; + + fn test(self, other: u32) -> u64 { + self + (other as u64) + } +} + +impl Test<u64> for u64 { + type Output = u64; + + fn test(self, other: u64) -> u64 { + (self + other) as u64 + } +} + +fn main() { + let xs: Vec<u64> = vec![1, 2, 3]; + println!("{}", 23u64.test(xs.iter().sum())); //~ ERROR: type annotations needed + //~^ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-69455.stderr b/tests/ui/issues/issue-69455.stderr new file mode 100644 index 000000000..fc343bb54 --- /dev/null +++ b/tests/ui/issues/issue-69455.stderr @@ -0,0 +1,39 @@ +error[E0284]: type annotations needed + --> $DIR/issue-69455.rs:29:41 + | +LL | println!("{}", 23u64.test(xs.iter().sum())); + | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | | + | type must be known at this point + | + = note: cannot satisfy `<u64 as Test<_>>::Output == _` +help: consider specifying the generic argument + | +LL | println!("{}", 23u64.test(xs.iter().sum::<S>())); + | +++++ + +error[E0283]: type annotations needed + --> $DIR/issue-69455.rs:29:41 + | +LL | println!("{}", 23u64.test(xs.iter().sum())); + | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | | + | required by a bound introduced by this call + | +note: multiple `impl`s satisfying `u64: Test<_>` found + --> $DIR/issue-69455.rs:11:1 + | +LL | impl Test<u32> for u64 { + | ^^^^^^^^^^^^^^^^^^^^^^ +... +LL | impl Test<u64> for u64 { + | ^^^^^^^^^^^^^^^^^^^^^^ +help: consider specifying the generic argument + | +LL | println!("{}", 23u64.test(xs.iter().sum::<S>())); + | +++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0283, E0284. +For more information about an error, try `rustc --explain E0283`. diff --git a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.rs b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.rs new file mode 100644 index 000000000..e98affc5c --- /dev/null +++ b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.rs @@ -0,0 +1,23 @@ +trait TraitA { + const VALUE: usize; +} + +struct A; +impl TraitA for A { + const VALUE: usize = 0; +} + +trait TraitB { + type MyA: TraitA; + const VALUE: usize = Self::MyA::VALUE; +} + +struct B; +impl TraitB for B { //~ ERROR not all trait items implemented, missing: `MyA` + type M = A; //~ ERROR type `M` is not a member of trait `TraitB` +} + +fn main() { + let _ = [0; B::VALUE]; + //~^ constant +} diff --git a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr new file mode 100644 index 000000000..ba385d887 --- /dev/null +++ b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr @@ -0,0 +1,25 @@ +error[E0437]: type `M` is not a member of trait `TraitB` + --> $DIR/issue-69602-type-err-during-codegen-ice.rs:17:5 + | +LL | type M = A; + | ^^^^^^^^^^^^^ not a member of trait `TraitB` + +error[E0046]: not all trait items implemented, missing: `MyA` + --> $DIR/issue-69602-type-err-during-codegen-ice.rs:16:1 + | +LL | type MyA: TraitA; + | ---------------- `MyA` from trait +... +LL | impl TraitB for B { + | ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation + +note: erroneous constant used + --> $DIR/issue-69602-type-err-during-codegen-ice.rs:21:17 + | +LL | let _ = [0; B::VALUE]; + | ^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0046, E0437. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/issues/issue-69683.rs b/tests/ui/issues/issue-69683.rs new file mode 100644 index 000000000..7a76e9ef2 --- /dev/null +++ b/tests/ui/issues/issue-69683.rs @@ -0,0 +1,33 @@ +pub trait Element<S> { + type Array; +} + +impl<T> Element<()> for T { + type Array = T; +} + +impl<T: Element<S>, S> Element<[S; 3]> for T { + type Array = [T::Array; 3]; +} + +trait Foo<I> +where + u8: Element<I>, +{ + fn foo(self, x: <u8 as Element<I>>::Array); +} + +impl<I> Foo<I> for u16 +where + u8: Element<I>, +{ + fn foo(self, _: <u8 as Element<I>>::Array) {} +} + +fn main() { + let b: [u8; 3] = [0u8; 3]; + + 0u16.foo(b); //~ ERROR type annotations needed + //~^ ERROR type annotations needed + //<u16 as Foo<[(); 3]>>::foo(0u16, b); +} diff --git a/tests/ui/issues/issue-69683.stderr b/tests/ui/issues/issue-69683.stderr new file mode 100644 index 000000000..193de1a35 --- /dev/null +++ b/tests/ui/issues/issue-69683.stderr @@ -0,0 +1,43 @@ +error[E0284]: type annotations needed + --> $DIR/issue-69683.rs:30:10 + | +LL | 0u16.foo(b); + | ^^^ + | + = note: cannot satisfy `<u8 as Element<_>>::Array == [u8; 3]` +help: try using a fully qualified path to specify the expected types + | +LL | <u16 as Foo<I>>::foo(0u16, b); + | +++++++++++++++++++++ ~ + +error[E0283]: type annotations needed + --> $DIR/issue-69683.rs:30:10 + | +LL | 0u16.foo(b); + | ^^^ + | +note: multiple `impl`s satisfying `u8: Element<_>` found + --> $DIR/issue-69683.rs:5:1 + | +LL | impl<T> Element<()> for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | impl<T: Element<S>, S> Element<[S; 3]> for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `Foo::foo` + --> $DIR/issue-69683.rs:15:9 + | +LL | u8: Element<I>, + | ^^^^^^^^^^ required by this bound in `Foo::foo` +LL | { +LL | fn foo(self, x: <u8 as Element<I>>::Array); + | --- required by a bound in this +help: try using a fully qualified path to specify the expected types + | +LL | <u16 as Foo<I>>::foo(0u16, b); + | +++++++++++++++++++++ ~ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0283, E0284. +For more information about an error, try `rustc --explain E0283`. diff --git a/tests/ui/issues/issue-70093.rs b/tests/ui/issues/issue-70093.rs new file mode 100644 index 000000000..86459dc90 --- /dev/null +++ b/tests/ui/issues/issue-70093.rs @@ -0,0 +1,10 @@ +// run-pass +// compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes +// ignore-windows - this will probably only work on unixish systems +// ignore-fuchsia - missing __libc_start_main for some reason (#84733) +// ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling + +#[link(name = "some-random-non-existent-library", kind = "static")] +extern "C" {} + +fn main() {} diff --git a/tests/ui/issues/issue-7012.rs b/tests/ui/issues/issue-7012.rs new file mode 100644 index 000000000..90eba1706 --- /dev/null +++ b/tests/ui/issues/issue-7012.rs @@ -0,0 +1,22 @@ +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +/* +# Comparison of static arrays + +The expected behaviour would be that `test == test1`, therefore 'true' +would be printed, however the below prints false. +*/ + +struct signature<'a> { pattern : &'a [u32] } + +static test1: signature<'static> = signature { + pattern: &[0x243f6a88,0x85a308d3,0x13198a2e,0x03707344,0xa4093822,0x299f31d0] +}; + +pub fn main() { + let test: &[u32] = &[0x243f6a88,0x85a308d3,0x13198a2e, + 0x03707344,0xa4093822,0x299f31d0]; + println!("{}",test==test1.pattern); +} diff --git a/tests/ui/issues/issue-70381.rs b/tests/ui/issues/issue-70381.rs new file mode 100644 index 000000000..3df8277b8 --- /dev/null +++ b/tests/ui/issues/issue-70381.rs @@ -0,0 +1,6 @@ +// Test that multi-byte unicode characters with missing parameters do not ICE. + +fn main() { + println!("\r¡{}") + //~^ ERROR 1 positional argument in format string +} diff --git a/tests/ui/issues/issue-70381.stderr b/tests/ui/issues/issue-70381.stderr new file mode 100644 index 000000000..96b8e6569 --- /dev/null +++ b/tests/ui/issues/issue-70381.stderr @@ -0,0 +1,8 @@ +error: 1 positional argument in format string, but no arguments were given + --> $DIR/issue-70381.rs:4:16 + | +LL | println!("\r¡{}") + | ^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-7044.rs b/tests/ui/issues/issue-7044.rs new file mode 100644 index 000000000..a6e22bc52 --- /dev/null +++ b/tests/ui/issues/issue-7044.rs @@ -0,0 +1,4 @@ +static X: isize = 0; +struct X; //~ ERROR the name `X` is defined multiple times + +fn main() {} diff --git a/tests/ui/issues/issue-7044.stderr b/tests/ui/issues/issue-7044.stderr new file mode 100644 index 000000000..2ad67ec23 --- /dev/null +++ b/tests/ui/issues/issue-7044.stderr @@ -0,0 +1,13 @@ +error[E0428]: the name `X` is defined multiple times + --> $DIR/issue-7044.rs:2:1 + | +LL | static X: isize = 0; + | -------------------- previous definition of the value `X` here +LL | struct X; + | ^^^^^^^^^ `X` redefined here + | + = note: `X` must be defined only once in the value namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-7061.rs b/tests/ui/issues/issue-7061.rs new file mode 100644 index 000000000..8a6ee920a --- /dev/null +++ b/tests/ui/issues/issue-7061.rs @@ -0,0 +1,10 @@ +struct BarStruct; + +impl<'a> BarStruct { + fn foo(&'a mut self) -> Box<BarStruct> { self } + //~^ ERROR mismatched types + //~| expected struct `Box<BarStruct>` + //~| found mutable reference `&'a mut BarStruct` +} + +fn main() {} diff --git a/tests/ui/issues/issue-7061.stderr b/tests/ui/issues/issue-7061.stderr new file mode 100644 index 000000000..27034378d --- /dev/null +++ b/tests/ui/issues/issue-7061.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-7061.rs:4:46 + | +LL | fn foo(&'a mut self) -> Box<BarStruct> { self } + | -------------- ^^^^ expected struct `Box`, found `&mut BarStruct` + | | + | expected `Box<BarStruct>` because of return type + | + = note: expected struct `Box<BarStruct>` + found mutable reference `&'a mut BarStruct` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-70673.rs b/tests/ui/issues/issue-70673.rs new file mode 100644 index 000000000..3561f4012 --- /dev/null +++ b/tests/ui/issues/issue-70673.rs @@ -0,0 +1,12 @@ +// Regression test for https://github.com/rust-lang/rust/issues/70673. + +// run-pass + +#![feature(thread_local)] + +#[thread_local] +static A: &u8 = &42; + +fn main() { + dbg!(*A); +} diff --git a/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs b/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs new file mode 100644 index 000000000..c2683157f --- /dev/null +++ b/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs @@ -0,0 +1,10 @@ +fn a() -> i32 { + 3 +} + +pub fn main() { + assert_eq!(a, 0); + //~^ ERROR binary operation `==` cannot + //~| ERROR mismatched types + //~| ERROR doesn't implement +} diff --git a/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr new file mode 100644 index 000000000..b30bcfb77 --- /dev/null +++ b/tests/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr @@ -0,0 +1,38 @@ +error[E0369]: binary operation `==` cannot be applied to type `fn() -> i32 {a}` + --> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 + | +LL | assert_eq!(a, 0); + | ^^^^^^^^^^^^^^^^ + | | + | fn() -> i32 {a} + | {integer} + | + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 + | +LL | assert_eq!(a, 0); + | ^^^^^^^^^^^^^^^^ expected fn item, found integer + | + = note: expected fn item `fn() -> i32 {a}` + found type `{integer}` + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `fn() -> i32 {a}` doesn't implement `Debug` + --> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 + | +LL | fn a() -> i32 { + | - consider calling this function +... +LL | assert_eq!(a, 0); + | ^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = help: the trait `Debug` is not implemented for fn item `fn() -> i32 {a}` + = help: use parentheses to call this function: `a()` + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0308, E0369. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-70746.rs b/tests/ui/issues/issue-70746.rs new file mode 100644 index 000000000..8930c15f5 --- /dev/null +++ b/tests/ui/issues/issue-70746.rs @@ -0,0 +1,29 @@ +// check-pass + +pub trait Trait1 { + type C; +} + +struct T1; +impl Trait1 for T1 { + type C = usize; +} +pub trait Callback<T: Trait1>: FnMut(<T as Trait1>::C) {} +impl<T: Trait1, F: FnMut(<T as Trait1>::C)> Callback<T> for F {} + +pub struct State<T: Trait1> { + callback: Option<Box<dyn Callback<T>>>, +} +impl<T: Trait1> State<T> { + fn new() -> Self { + Self { callback: None } + } + fn test_cb(&mut self, d: <T as Trait1>::C) { + (self.callback.as_mut().unwrap())(d) + } +} + +fn main() { + let mut s = State::<T1>::new(); + s.test_cb(1); +} diff --git a/tests/ui/issues/issue-7092.rs b/tests/ui/issues/issue-7092.rs new file mode 100644 index 000000000..85bfbf90d --- /dev/null +++ b/tests/ui/issues/issue-7092.rs @@ -0,0 +1,15 @@ +enum Whatever { +} + +fn foo(x: Whatever) { + match x { + Some(field) => +//~^ ERROR mismatched types +//~| expected enum `Whatever`, found enum `Option` +//~| expected enum `Whatever` +//~| found enum `Option<_>` + field.access(), + } +} + +fn main(){} diff --git a/tests/ui/issues/issue-7092.stderr b/tests/ui/issues/issue-7092.stderr new file mode 100644 index 000000000..59e8d75e2 --- /dev/null +++ b/tests/ui/issues/issue-7092.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-7092.rs:6:9 + | +LL | match x { + | - this expression has type `Whatever` +LL | Some(field) => + | ^^^^^^^^^^^ expected enum `Whatever`, found enum `Option` + | + = note: expected enum `Whatever` + found enum `Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-71406.rs b/tests/ui/issues/issue-71406.rs new file mode 100644 index 000000000..6266112c3 --- /dev/null +++ b/tests/ui/issues/issue-71406.rs @@ -0,0 +1,6 @@ +use std::sync::mpsc; + +fn main() { + let (tx, rx) = mpsc::channel::new(1); + //~^ ERROR expected type, found function `channel` in `mpsc` +} diff --git a/tests/ui/issues/issue-71406.stderr b/tests/ui/issues/issue-71406.stderr new file mode 100644 index 000000000..918163b60 --- /dev/null +++ b/tests/ui/issues/issue-71406.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: expected type, found function `channel` in `mpsc` + --> $DIR/issue-71406.rs:4:26 + | +LL | let (tx, rx) = mpsc::channel::new(1); + | ^^^^^^^ expected type, found function `channel` in `mpsc` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/issues/issue-71584.rs b/tests/ui/issues/issue-71584.rs new file mode 100644 index 000000000..7bf3ed60e --- /dev/null +++ b/tests/ui/issues/issue-71584.rs @@ -0,0 +1,6 @@ +fn main() { + let n: u32 = 1; + let mut d: u64 = 2; + d = d % n.into(); + //~^ ERROR type annotations needed +} diff --git a/tests/ui/issues/issue-71584.stderr b/tests/ui/issues/issue-71584.stderr new file mode 100644 index 000000000..6ddb76573 --- /dev/null +++ b/tests/ui/issues/issue-71584.stderr @@ -0,0 +1,17 @@ +error[E0284]: type annotations needed + --> $DIR/issue-71584.rs:4:15 + | +LL | d = d % n.into(); + | - ^^^^ + | | + | type must be known at this point + | + = note: cannot satisfy `<u64 as Rem<_>>::Output == u64` +help: try using a fully qualified path to specify the expected types + | +LL | d = d % <u32 as Into<T>>::into(n); + | +++++++++++++++++++++++ ~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/issues/issue-71676-1.fixed b/tests/ui/issues/issue-71676-1.fixed new file mode 100644 index 000000000..cbc0e8c06 --- /dev/null +++ b/tests/ui/issues/issue-71676-1.fixed @@ -0,0 +1,53 @@ +// run-rustfix +use std::ops::Deref; +use std::ops::DerefMut; +struct Bar(u8); +struct Foo(Bar); +struct Emm(Foo); +impl Deref for Bar{ + type Target = u8; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Foo { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Emm { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl DerefMut for Bar{ + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Foo { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Emm { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +fn main() { + // Suggest dereference with arbitrary mutability + let a = Emm(Foo(Bar(0))); + let _: *const u8 = &***a; //~ ERROR mismatched types + + let mut a = Emm(Foo(Bar(0))); + let _: *mut u8 = &mut ***a; //~ ERROR mismatched types + + let a = Emm(Foo(Bar(0))); + let _: *const u8 = &***a; //~ ERROR mismatched types + + let mut a = Emm(Foo(Bar(0))); + let _: *mut u8 = &mut ***a; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-71676-1.rs b/tests/ui/issues/issue-71676-1.rs new file mode 100644 index 000000000..6e87c7174 --- /dev/null +++ b/tests/ui/issues/issue-71676-1.rs @@ -0,0 +1,53 @@ +// run-rustfix +use std::ops::Deref; +use std::ops::DerefMut; +struct Bar(u8); +struct Foo(Bar); +struct Emm(Foo); +impl Deref for Bar{ + type Target = u8; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Foo { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Emm { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl DerefMut for Bar{ + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Foo { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Emm { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +fn main() { + // Suggest dereference with arbitrary mutability + let a = Emm(Foo(Bar(0))); + let _: *const u8 = &a; //~ ERROR mismatched types + + let mut a = Emm(Foo(Bar(0))); + let _: *mut u8 = &a; //~ ERROR mismatched types + + let a = Emm(Foo(Bar(0))); + let _: *const u8 = &mut a; //~ ERROR mismatched types + + let mut a = Emm(Foo(Bar(0))); + let _: *mut u8 = &mut a; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-71676-1.stderr b/tests/ui/issues/issue-71676-1.stderr new file mode 100644 index 000000000..2104634eb --- /dev/null +++ b/tests/ui/issues/issue-71676-1.stderr @@ -0,0 +1,63 @@ +error[E0308]: mismatched types + --> $DIR/issue-71676-1.rs:43:24 + | +LL | let _: *const u8 = &a; + | --------- ^^ expected `u8`, found struct `Emm` + | | + | expected due to this + | + = note: expected raw pointer `*const u8` + found reference `&Emm` +help: consider dereferencing + | +LL | let _: *const u8 = &***a; + | +++ + +error[E0308]: mismatched types + --> $DIR/issue-71676-1.rs:46:22 + | +LL | let _: *mut u8 = &a; + | ------- ^^ types differ in mutability + | | + | expected due to this + | + = note: expected raw pointer `*mut u8` + found reference `&Emm` +help: consider dereferencing + | +LL | let _: *mut u8 = &mut ***a; + | +++++++ + +error[E0308]: mismatched types + --> $DIR/issue-71676-1.rs:49:24 + | +LL | let _: *const u8 = &mut a; + | --------- ^^^^^^ expected `u8`, found struct `Emm` + | | + | expected due to this + | + = note: expected raw pointer `*const u8` + found mutable reference `&mut Emm` +help: consider dereferencing + | +LL | let _: *const u8 = &***a; + | ~~~ + +error[E0308]: mismatched types + --> $DIR/issue-71676-1.rs:52:22 + | +LL | let _: *mut u8 = &mut a; + | ------- ^^^^^^ expected `u8`, found struct `Emm` + | | + | expected due to this + | + = note: expected raw pointer `*mut u8` + found mutable reference `&mut Emm` +help: consider dereferencing + | +LL | let _: *mut u8 = &mut ***a; + | +++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-71676-2.rs b/tests/ui/issues/issue-71676-2.rs new file mode 100644 index 000000000..f3183899d --- /dev/null +++ b/tests/ui/issues/issue-71676-2.rs @@ -0,0 +1,42 @@ +use std::ops::Deref; +use std::ops::DerefMut; +struct Bar(u8); +struct Foo(Bar); +struct Emm(Foo); +impl Deref for Bar{ + type Target = u8; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Foo { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Emm { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl DerefMut for Bar{ + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Foo { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Emm { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +fn main() { + let a = Emm(Foo(Bar(0))); + let _: *mut u8 = &a; //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-71676-2.stderr b/tests/ui/issues/issue-71676-2.stderr new file mode 100644 index 000000000..80fb4aed1 --- /dev/null +++ b/tests/ui/issues/issue-71676-2.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-71676-2.rs:41:22 + | +LL | let _: *mut u8 = &a; + | ------- ^^ types differ in mutability + | | + | expected due to this + | + = note: expected raw pointer `*mut u8` + found reference `&Emm` +help: consider dereferencing + | +LL | let _: *mut u8 = &mut ***a; + | +++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-7178.rs b/tests/ui/issues/issue-7178.rs new file mode 100644 index 000000000..30aa736cd --- /dev/null +++ b/tests/ui/issues/issue-7178.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-7178.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_7178 as cross_crate_self; + +pub fn main() { + let _ = cross_crate_self::Foo::new(&1); +} diff --git a/tests/ui/issues/issue-72002.rs b/tests/ui/issues/issue-72002.rs new file mode 100644 index 000000000..54ff89355 --- /dev/null +++ b/tests/ui/issues/issue-72002.rs @@ -0,0 +1,29 @@ +// check-pass +struct Indexable; + +impl Indexable { + fn boo(&mut self) {} +} + +impl std::ops::Index<&str> for Indexable { + type Output = Indexable; + + fn index(&self, field: &str) -> &Indexable { + self + } +} + +impl std::ops::IndexMut<&str> for Indexable { + fn index_mut(&mut self, field: &str) -> &mut Indexable { + self + } +} + +fn main() { + let mut v = Indexable; + let field = "hello".to_string(); + + v[field.as_str()].boo(); + + v[&field].boo(); // < This should work +} diff --git a/tests/ui/issues/issue-72076.rs b/tests/ui/issues/issue-72076.rs new file mode 100644 index 000000000..1659044a6 --- /dev/null +++ b/tests/ui/issues/issue-72076.rs @@ -0,0 +1,6 @@ +trait X { + type S; + fn f() -> Self::S {} //~ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/issues/issue-72076.stderr b/tests/ui/issues/issue-72076.stderr new file mode 100644 index 000000000..b942cf75b --- /dev/null +++ b/tests/ui/issues/issue-72076.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-72076.rs:3:23 + | +LL | fn f() -> Self::S {} + | ^^ expected associated type, found `()` + | + = note: expected associated type `<Self as X>::S` + found unit type `()` + = help: consider constraining the associated type `<Self as X>::S` to `()` or calling a method that returns `<Self as X>::S` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-72278.rs b/tests/ui/issues/issue-72278.rs new file mode 100644 index 000000000..92fd1f73a --- /dev/null +++ b/tests/ui/issues/issue-72278.rs @@ -0,0 +1,19 @@ +// run-pass + +#![allow(unused)] + +struct S; + +impl S { + fn func<'a, U>(&'a self) -> U { + todo!() + } +} + +fn dont_crash<'a, U>() -> U { + S.func::<'a, U>() + //~^ WARN cannot specify lifetime arguments explicitly + //~| WARN this was previously accepted +} + +fn main() {} diff --git a/tests/ui/issues/issue-72278.stderr b/tests/ui/issues/issue-72278.stderr new file mode 100644 index 000000000..5468837a3 --- /dev/null +++ b/tests/ui/issues/issue-72278.stderr @@ -0,0 +1,15 @@ +warning: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present + --> $DIR/issue-72278.rs:14:14 + | +LL | fn func<'a, U>(&'a self) -> U { + | -- the late bound lifetime parameter is introduced here +... +LL | S.func::<'a, U>() + | ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868> + = note: `#[warn(late_bound_lifetime_arguments)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/issues/issue-7246.rs b/tests/ui/issues/issue-7246.rs new file mode 100644 index 000000000..7b16fa024 --- /dev/null +++ b/tests/ui/issues/issue-7246.rs @@ -0,0 +1,11 @@ +#![deny(unreachable_code)] +#![allow(dead_code)] + +use std::ptr; +pub unsafe fn g() { + return; + if *ptr::null() {}; //~ ERROR unreachable + //~| WARNING dereferencing a null pointer +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-7246.stderr b/tests/ui/issues/issue-7246.stderr new file mode 100644 index 000000000..a9bf2bf76 --- /dev/null +++ b/tests/ui/issues/issue-7246.stderr @@ -0,0 +1,24 @@ +error: unreachable statement + --> $DIR/issue-7246.rs:7:5 + | +LL | return; + | ------ any code following this expression is unreachable +LL | if *ptr::null() {}; + | ^^^^^^^^^^^^^^^^^^^ unreachable statement + | +note: the lint level is defined here + --> $DIR/issue-7246.rs:1:9 + | +LL | #![deny(unreachable_code)] + | ^^^^^^^^^^^^^^^^ + +warning: dereferencing a null pointer + --> $DIR/issue-7246.rs:7:8 + | +LL | if *ptr::null() {}; + | ^^^^^^^^^^^^ this code causes undefined behavior when executed + | + = note: `#[warn(deref_nullptr)]` on by default + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/issues/issue-7268.rs b/tests/ui/issues/issue-7268.rs new file mode 100644 index 000000000..309176fb0 --- /dev/null +++ b/tests/ui/issues/issue-7268.rs @@ -0,0 +1,10 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +fn foo<T: 'static>(_: T) {} + +fn bar<T>(x: &'static T) { + foo(x); +} +fn main() {} diff --git a/tests/ui/issues/issue-72839-error-overflow.rs b/tests/ui/issues/issue-72839-error-overflow.rs new file mode 100644 index 000000000..6562d2284 --- /dev/null +++ b/tests/ui/issues/issue-72839-error-overflow.rs @@ -0,0 +1,19 @@ +// Regression test for issue #72839 +// Tests that we do not overflow during trait selection after +// a type error occurs +use std::ops::Rem; +trait Foo {} +struct MyStruct<T>(T); + +impl<T, U> Rem<MyStruct<T>> for MyStruct<U> where MyStruct<U>: Rem<MyStruct<T>> { + type Output = u8; + fn rem(self, _: MyStruct<T>) -> Self::Output { + panic!() + } +} + +fn main() {} + +fn foo() { + if missing_var % 8 == 0 {} //~ ERROR cannot find +} diff --git a/tests/ui/issues/issue-72839-error-overflow.stderr b/tests/ui/issues/issue-72839-error-overflow.stderr new file mode 100644 index 000000000..c4b6f90ca --- /dev/null +++ b/tests/ui/issues/issue-72839-error-overflow.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `missing_var` in this scope + --> $DIR/issue-72839-error-overflow.rs:18:8 + | +LL | if missing_var % 8 == 0 {} + | ^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/issues/issue-72933-match-stack-overflow.rs b/tests/ui/issues/issue-72933-match-stack-overflow.rs new file mode 100644 index 000000000..aa796bcf5 --- /dev/null +++ b/tests/ui/issues/issue-72933-match-stack-overflow.rs @@ -0,0 +1,5208 @@ +// build-pass +// ignore-tidy-filelength +#![crate_type="rlib"] + +fn banana(v: &str) -> u32 { + match v { + "0" => 0, + "1" => 1, + "2" => 2, + "3" => 3, + "4" => 4, + "5" => 5, + "6" => 6, + "7" => 7, + "8" => 8, + "9" => 9, + "10" => 10, + "11" => 11, + "12" => 12, + "13" => 13, + "14" => 14, + "15" => 15, + "16" => 16, + "17" => 17, + "18" => 18, + "19" => 19, + "20" => 20, + "21" => 21, + "22" => 22, + "23" => 23, + "24" => 24, + "25" => 25, + "26" => 26, + "27" => 27, + "28" => 28, + "29" => 29, + "30" => 30, + "31" => 31, + "32" => 32, + "33" => 33, + "34" => 34, + "35" => 35, + "36" => 36, + "37" => 37, + "38" => 38, + "39" => 39, + "40" => 40, + "41" => 41, + "42" => 42, + "43" => 43, + "44" => 44, + "45" => 45, + "46" => 46, + "47" => 47, + "48" => 48, + "49" => 49, + "50" => 50, + "51" => 51, + "52" => 52, + "53" => 53, + "54" => 54, + "55" => 55, + "56" => 56, + "57" => 57, + "58" => 58, + "59" => 59, + "60" => 60, + "61" => 61, + "62" => 62, + "63" => 63, + "64" => 64, + "65" => 65, + "66" => 66, + "67" => 67, + "68" => 68, + "69" => 69, + "70" => 70, + "71" => 71, + "72" => 72, + "73" => 73, + "74" => 74, + "75" => 75, + "76" => 76, + "77" => 77, + "78" => 78, + "79" => 79, + "80" => 80, + "81" => 81, + "82" => 82, + "83" => 83, + "84" => 84, + "85" => 85, + "86" => 86, + "87" => 87, + "88" => 88, + "89" => 89, + "90" => 90, + "91" => 91, + "92" => 92, + "93" => 93, + "94" => 94, + "95" => 95, + "96" => 96, + "97" => 97, + "98" => 98, + "99" => 99, + "100" => 100, + "101" => 101, + "102" => 102, + "103" => 103, + "104" => 104, + "105" => 105, + "106" => 106, + "107" => 107, + "108" => 108, + "109" => 109, + "110" => 110, + "111" => 111, + "112" => 112, + "113" => 113, + "114" => 114, + "115" => 115, + "116" => 116, + "117" => 117, + "118" => 118, + "119" => 119, + "120" => 120, + "121" => 121, + "122" => 122, + "123" => 123, + "124" => 124, + "125" => 125, + "126" => 126, + "127" => 127, + "128" => 128, + "129" => 129, + "130" => 130, + "131" => 131, + "132" => 132, + "133" => 133, + "134" => 134, + "135" => 135, + "136" => 136, + "137" => 137, + "138" => 138, + "139" => 139, + "140" => 140, + "141" => 141, + "142" => 142, + "143" => 143, + "144" => 144, + "145" => 145, + "146" => 146, + "147" => 147, + "148" => 148, + "149" => 149, + "150" => 150, + "151" => 151, + "152" => 152, + "153" => 153, + "154" => 154, + "155" => 155, + "156" => 156, + "157" => 157, + "158" => 158, + "159" => 159, + "160" => 160, + "161" => 161, + "162" => 162, + "163" => 163, + "164" => 164, + "165" => 165, + "166" => 166, + "167" => 167, + "168" => 168, + "169" => 169, + "170" => 170, + "171" => 171, + "172" => 172, + "173" => 173, + "174" => 174, + "175" => 175, + "176" => 176, + "177" => 177, + "178" => 178, + "179" => 179, + "180" => 180, + "181" => 181, + "182" => 182, + "183" => 183, + "184" => 184, + "185" => 185, + "186" => 186, + "187" => 187, + "188" => 188, + "189" => 189, + "190" => 190, + "191" => 191, + "192" => 192, + "193" => 193, + "194" => 194, + "195" => 195, + "196" => 196, + "197" => 197, + "198" => 198, + "199" => 199, + "200" => 200, + "201" => 201, + "202" => 202, + "203" => 203, + "204" => 204, + "205" => 205, + "206" => 206, + "207" => 207, + "208" => 208, + "209" => 209, + "210" => 210, + "211" => 211, + "212" => 212, + "213" => 213, + "214" => 214, + "215" => 215, + "216" => 216, + "217" => 217, + "218" => 218, + "219" => 219, + "220" => 220, + "221" => 221, + "222" => 222, + "223" => 223, + "224" => 224, + "225" => 225, + "226" => 226, + "227" => 227, + "228" => 228, + "229" => 229, + "230" => 230, + "231" => 231, + "232" => 232, + "233" => 233, + "234" => 234, + "235" => 235, + "236" => 236, + "237" => 237, + "238" => 238, + "239" => 239, + "240" => 240, + "241" => 241, + "242" => 242, + "243" => 243, + "244" => 244, + "245" => 245, + "246" => 246, + "247" => 247, + "248" => 248, + "249" => 249, + "250" => 250, + "251" => 251, + "252" => 252, + "253" => 253, + "254" => 254, + "255" => 255, + "256" => 256, + "257" => 257, + "258" => 258, + "259" => 259, + "260" => 260, + "261" => 261, + "262" => 262, + "263" => 263, + "264" => 264, + "265" => 265, + "266" => 266, + "267" => 267, + "268" => 268, + "269" => 269, + "270" => 270, + "271" => 271, + "272" => 272, + "273" => 273, + "274" => 274, + "275" => 275, + "276" => 276, + "277" => 277, + "278" => 278, + "279" => 279, + "280" => 280, + "281" => 281, + "282" => 282, + "283" => 283, + "284" => 284, + "285" => 285, + "286" => 286, + "287" => 287, + "288" => 288, + "289" => 289, + "290" => 290, + "291" => 291, + "292" => 292, + "293" => 293, + "294" => 294, + "295" => 295, + "296" => 296, + "297" => 297, + "298" => 298, + "299" => 299, + "300" => 300, + "301" => 301, + "302" => 302, + "303" => 303, + "304" => 304, + "305" => 305, + "306" => 306, + "307" => 307, + "308" => 308, + "309" => 309, + "310" => 310, + "311" => 311, + "312" => 312, + "313" => 313, + "314" => 314, + "315" => 315, + "316" => 316, + "317" => 317, + "318" => 318, + "319" => 319, + "320" => 320, + "321" => 321, + "322" => 322, + "323" => 323, + "324" => 324, + "325" => 325, + "326" => 326, + "327" => 327, + "328" => 328, + "329" => 329, + "330" => 330, + "331" => 331, + "332" => 332, + "333" => 333, + "334" => 334, + "335" => 335, + "336" => 336, + "337" => 337, + "338" => 338, + "339" => 339, + "340" => 340, + "341" => 341, + "342" => 342, + "343" => 343, + "344" => 344, + "345" => 345, + "346" => 346, + "347" => 347, + "348" => 348, + "349" => 349, + "350" => 350, + "351" => 351, + "352" => 352, + "353" => 353, + "354" => 354, + "355" => 355, + "356" => 356, + "357" => 357, + "358" => 358, + "359" => 359, + "360" => 360, + "361" => 361, + "362" => 362, + "363" => 363, + "364" => 364, + "365" => 365, + "366" => 366, + "367" => 367, + "368" => 368, + "369" => 369, + "370" => 370, + "371" => 371, + "372" => 372, + "373" => 373, + "374" => 374, + "375" => 375, + "376" => 376, + "377" => 377, + "378" => 378, + "379" => 379, + "380" => 380, + "381" => 381, + "382" => 382, + "383" => 383, + "384" => 384, + "385" => 385, + "386" => 386, + "387" => 387, + "388" => 388, + "389" => 389, + "390" => 390, + "391" => 391, + "392" => 392, + "393" => 393, + "394" => 394, + "395" => 395, + "396" => 396, + "397" => 397, + "398" => 398, + "399" => 399, + "400" => 400, + "401" => 401, + "402" => 402, + "403" => 403, + "404" => 404, + "405" => 405, + "406" => 406, + "407" => 407, + "408" => 408, + "409" => 409, + "410" => 410, + "411" => 411, + "412" => 412, + "413" => 413, + "414" => 414, + "415" => 415, + "416" => 416, + "417" => 417, + "418" => 418, + "419" => 419, + "420" => 420, + "421" => 421, + "422" => 422, + "423" => 423, + "424" => 424, + "425" => 425, + "426" => 426, + "427" => 427, + "428" => 428, + "429" => 429, + "430" => 430, + "431" => 431, + "432" => 432, + "433" => 433, + "434" => 434, + "435" => 435, + "436" => 436, + "437" => 437, + "438" => 438, + "439" => 439, + "440" => 440, + "441" => 441, + "442" => 442, + "443" => 443, + "444" => 444, + "445" => 445, + "446" => 446, + "447" => 447, + "448" => 448, + "449" => 449, + "450" => 450, + "451" => 451, + "452" => 452, + "453" => 453, + "454" => 454, + "455" => 455, + "456" => 456, + "457" => 457, + "458" => 458, + "459" => 459, + "460" => 460, + "461" => 461, + "462" => 462, + "463" => 463, + "464" => 464, + "465" => 465, + "466" => 466, + "467" => 467, + "468" => 468, + "469" => 469, + "470" => 470, + "471" => 471, + "472" => 472, + "473" => 473, + "474" => 474, + "475" => 475, + "476" => 476, + "477" => 477, + "478" => 478, + "479" => 479, + "480" => 480, + "481" => 481, + "482" => 482, + "483" => 483, + "484" => 484, + "485" => 485, + "486" => 486, + "487" => 487, + "488" => 488, + "489" => 489, + "490" => 490, + "491" => 491, + "492" => 492, + "493" => 493, + "494" => 494, + "495" => 495, + "496" => 496, + "497" => 497, + "498" => 498, + "499" => 499, + "500" => 500, + "501" => 501, + "502" => 502, + "503" => 503, + "504" => 504, + "505" => 505, + "506" => 506, + "507" => 507, + "508" => 508, + "509" => 509, + "510" => 510, + "511" => 511, + "512" => 512, + "513" => 513, + "514" => 514, + "515" => 515, + "516" => 516, + "517" => 517, + "518" => 518, + "519" => 519, + "520" => 520, + "521" => 521, + "522" => 522, + "523" => 523, + "524" => 524, + "525" => 525, + "526" => 526, + "527" => 527, + "528" => 528, + "529" => 529, + "530" => 530, + "531" => 531, + "532" => 532, + "533" => 533, + "534" => 534, + "535" => 535, + "536" => 536, + "537" => 537, + "538" => 538, + "539" => 539, + "540" => 540, + "541" => 541, + "542" => 542, + "543" => 543, + "544" => 544, + "545" => 545, + "546" => 546, + "547" => 547, + "548" => 548, + "549" => 549, + "550" => 550, + "551" => 551, + "552" => 552, + "553" => 553, + "554" => 554, + "555" => 555, + "556" => 556, + "557" => 557, + "558" => 558, + "559" => 559, + "560" => 560, + "561" => 561, + "562" => 562, + "563" => 563, + "564" => 564, + "565" => 565, + "566" => 566, + "567" => 567, + "568" => 568, + "569" => 569, + "570" => 570, + "571" => 571, + "572" => 572, + "573" => 573, + "574" => 574, + "575" => 575, + "576" => 576, + "577" => 577, + "578" => 578, + "579" => 579, + "580" => 580, + "581" => 581, + "582" => 582, + "583" => 583, + "584" => 584, + "585" => 585, + "586" => 586, + "587" => 587, + "588" => 588, + "589" => 589, + "590" => 590, + "591" => 591, + "592" => 592, + "593" => 593, + "594" => 594, + "595" => 595, + "596" => 596, + "597" => 597, + "598" => 598, + "599" => 599, + "600" => 600, + "601" => 601, + "602" => 602, + "603" => 603, + "604" => 604, + "605" => 605, + "606" => 606, + "607" => 607, + "608" => 608, + "609" => 609, + "610" => 610, + "611" => 611, + "612" => 612, + "613" => 613, + "614" => 614, + "615" => 615, + "616" => 616, + "617" => 617, + "618" => 618, + "619" => 619, + "620" => 620, + "621" => 621, + "622" => 622, + "623" => 623, + "624" => 624, + "625" => 625, + "626" => 626, + "627" => 627, + "628" => 628, + "629" => 629, + "630" => 630, + "631" => 631, + "632" => 632, + "633" => 633, + "634" => 634, + "635" => 635, + "636" => 636, + "637" => 637, + "638" => 638, + "639" => 639, + "640" => 640, + "641" => 641, + "642" => 642, + "643" => 643, + "644" => 644, + "645" => 645, + "646" => 646, + "647" => 647, + "648" => 648, + "649" => 649, + "650" => 650, + "651" => 651, + "652" => 652, + "653" => 653, + "654" => 654, + "655" => 655, + "656" => 656, + "657" => 657, + "658" => 658, + "659" => 659, + "660" => 660, + "661" => 661, + "662" => 662, + "663" => 663, + "664" => 664, + "665" => 665, + "666" => 666, + "667" => 667, + "668" => 668, + "669" => 669, + "670" => 670, + "671" => 671, + "672" => 672, + "673" => 673, + "674" => 674, + "675" => 675, + "676" => 676, + "677" => 677, + "678" => 678, + "679" => 679, + "680" => 680, + "681" => 681, + "682" => 682, + "683" => 683, + "684" => 684, + "685" => 685, + "686" => 686, + "687" => 687, + "688" => 688, + "689" => 689, + "690" => 690, + "691" => 691, + "692" => 692, + "693" => 693, + "694" => 694, + "695" => 695, + "696" => 696, + "697" => 697, + "698" => 698, + "699" => 699, + "700" => 700, + "701" => 701, + "702" => 702, + "703" => 703, + "704" => 704, + "705" => 705, + "706" => 706, + "707" => 707, + "708" => 708, + "709" => 709, + "710" => 710, + "711" => 711, + "712" => 712, + "713" => 713, + "714" => 714, + "715" => 715, + "716" => 716, + "717" => 717, + "718" => 718, + "719" => 719, + "720" => 720, + "721" => 721, + "722" => 722, + "723" => 723, + "724" => 724, + "725" => 725, + "726" => 726, + "727" => 727, + "728" => 728, + "729" => 729, + "730" => 730, + "731" => 731, + "732" => 732, + "733" => 733, + "734" => 734, + "735" => 735, + "736" => 736, + "737" => 737, + "738" => 738, + "739" => 739, + "740" => 740, + "741" => 741, + "742" => 742, + "743" => 743, + "744" => 744, + "745" => 745, + "746" => 746, + "747" => 747, + "748" => 748, + "749" => 749, + "750" => 750, + "751" => 751, + "752" => 752, + "753" => 753, + "754" => 754, + "755" => 755, + "756" => 756, + "757" => 757, + "758" => 758, + "759" => 759, + "760" => 760, + "761" => 761, + "762" => 762, + "763" => 763, + "764" => 764, + "765" => 765, + "766" => 766, + "767" => 767, + "768" => 768, + "769" => 769, + "770" => 770, + "771" => 771, + "772" => 772, + "773" => 773, + "774" => 774, + "775" => 775, + "776" => 776, + "777" => 777, + "778" => 778, + "779" => 779, + "780" => 780, + "781" => 781, + "782" => 782, + "783" => 783, + "784" => 784, + "785" => 785, + "786" => 786, + "787" => 787, + "788" => 788, + "789" => 789, + "790" => 790, + "791" => 791, + "792" => 792, + "793" => 793, + "794" => 794, + "795" => 795, + "796" => 796, + "797" => 797, + "798" => 798, + "799" => 799, + "800" => 800, + "801" => 801, + "802" => 802, + "803" => 803, + "804" => 804, + "805" => 805, + "806" => 806, + "807" => 807, + "808" => 808, + "809" => 809, + "810" => 810, + "811" => 811, + "812" => 812, + "813" => 813, + "814" => 814, + "815" => 815, + "816" => 816, + "817" => 817, + "818" => 818, + "819" => 819, + "820" => 820, + "821" => 821, + "822" => 822, + "823" => 823, + "824" => 824, + "825" => 825, + "826" => 826, + "827" => 827, + "828" => 828, + "829" => 829, + "830" => 830, + "831" => 831, + "832" => 832, + "833" => 833, + "834" => 834, + "835" => 835, + "836" => 836, + "837" => 837, + "838" => 838, + "839" => 839, + "840" => 840, + "841" => 841, + "842" => 842, + "843" => 843, + "844" => 844, + "845" => 845, + "846" => 846, + "847" => 847, + "848" => 848, + "849" => 849, + "850" => 850, + "851" => 851, + "852" => 852, + "853" => 853, + "854" => 854, + "855" => 855, + "856" => 856, + "857" => 857, + "858" => 858, + "859" => 859, + "860" => 860, + "861" => 861, + "862" => 862, + "863" => 863, + "864" => 864, + "865" => 865, + "866" => 866, + "867" => 867, + "868" => 868, + "869" => 869, + "870" => 870, + "871" => 871, + "872" => 872, + "873" => 873, + "874" => 874, + "875" => 875, + "876" => 876, + "877" => 877, + "878" => 878, + "879" => 879, + "880" => 880, + "881" => 881, + "882" => 882, + "883" => 883, + "884" => 884, + "885" => 885, + "886" => 886, + "887" => 887, + "888" => 888, + "889" => 889, + "890" => 890, + "891" => 891, + "892" => 892, + "893" => 893, + "894" => 894, + "895" => 895, + "896" => 896, + "897" => 897, + "898" => 898, + "899" => 899, + "900" => 900, + "901" => 901, + "902" => 902, + "903" => 903, + "904" => 904, + "905" => 905, + "906" => 906, + "907" => 907, + "908" => 908, + "909" => 909, + "910" => 910, + "911" => 911, + "912" => 912, + "913" => 913, + "914" => 914, + "915" => 915, + "916" => 916, + "917" => 917, + "918" => 918, + "919" => 919, + "920" => 920, + "921" => 921, + "922" => 922, + "923" => 923, + "924" => 924, + "925" => 925, + "926" => 926, + "927" => 927, + "928" => 928, + "929" => 929, + "930" => 930, + "931" => 931, + "932" => 932, + "933" => 933, + "934" => 934, + "935" => 935, + "936" => 936, + "937" => 937, + "938" => 938, + "939" => 939, + "940" => 940, + "941" => 941, + "942" => 942, + "943" => 943, + "944" => 944, + "945" => 945, + "946" => 946, + "947" => 947, + "948" => 948, + "949" => 949, + "950" => 950, + "951" => 951, + "952" => 952, + "953" => 953, + "954" => 954, + "955" => 955, + "956" => 956, + "957" => 957, + "958" => 958, + "959" => 959, + "960" => 960, + "961" => 961, + "962" => 962, + "963" => 963, + "964" => 964, + "965" => 965, + "966" => 966, + "967" => 967, + "968" => 968, + "969" => 969, + "970" => 970, + "971" => 971, + "972" => 972, + "973" => 973, + "974" => 974, + "975" => 975, + "976" => 976, + "977" => 977, + "978" => 978, + "979" => 979, + "980" => 980, + "981" => 981, + "982" => 982, + "983" => 983, + "984" => 984, + "985" => 985, + "986" => 986, + "987" => 987, + "988" => 988, + "989" => 989, + "990" => 990, + "991" => 991, + "992" => 992, + "993" => 993, + "994" => 994, + "995" => 995, + "996" => 996, + "997" => 997, + "998" => 998, + "999" => 999, + "1000" => 1000, + "1001" => 1001, + "1002" => 1002, + "1003" => 1003, + "1004" => 1004, + "1005" => 1005, + "1006" => 1006, + "1007" => 1007, + "1008" => 1008, + "1009" => 1009, + "1010" => 1010, + "1011" => 1011, + "1012" => 1012, + "1013" => 1013, + "1014" => 1014, + "1015" => 1015, + "1016" => 1016, + "1017" => 1017, + "1018" => 1018, + "1019" => 1019, + "1020" => 1020, + "1021" => 1021, + "1022" => 1022, + "1023" => 1023, + "1024" => 1024, + "1025" => 1025, + "1026" => 1026, + "1027" => 1027, + "1028" => 1028, + "1029" => 1029, + "1030" => 1030, + "1031" => 1031, + "1032" => 1032, + "1033" => 1033, + "1034" => 1034, + "1035" => 1035, + "1036" => 1036, + "1037" => 1037, + "1038" => 1038, + "1039" => 1039, + "1040" => 1040, + "1041" => 1041, + "1042" => 1042, + "1043" => 1043, + "1044" => 1044, + "1045" => 1045, + "1046" => 1046, + "1047" => 1047, + "1048" => 1048, + "1049" => 1049, + "1050" => 1050, + "1051" => 1051, + "1052" => 1052, + "1053" => 1053, + "1054" => 1054, + "1055" => 1055, + "1056" => 1056, + "1057" => 1057, + "1058" => 1058, + "1059" => 1059, + "1060" => 1060, + "1061" => 1061, + "1062" => 1062, + "1063" => 1063, + "1064" => 1064, + "1065" => 1065, + "1066" => 1066, + "1067" => 1067, + "1068" => 1068, + "1069" => 1069, + "1070" => 1070, + "1071" => 1071, + "1072" => 1072, + "1073" => 1073, + "1074" => 1074, + "1075" => 1075, + "1076" => 1076, + "1077" => 1077, + "1078" => 1078, + "1079" => 1079, + "1080" => 1080, + "1081" => 1081, + "1082" => 1082, + "1083" => 1083, + "1084" => 1084, + "1085" => 1085, + "1086" => 1086, + "1087" => 1087, + "1088" => 1088, + "1089" => 1089, + "1090" => 1090, + "1091" => 1091, + "1092" => 1092, + "1093" => 1093, + "1094" => 1094, + "1095" => 1095, + "1096" => 1096, + "1097" => 1097, + "1098" => 1098, + "1099" => 1099, + "1100" => 1100, + "1101" => 1101, + "1102" => 1102, + "1103" => 1103, + "1104" => 1104, + "1105" => 1105, + "1106" => 1106, + "1107" => 1107, + "1108" => 1108, + "1109" => 1109, + "1110" => 1110, + "1111" => 1111, + "1112" => 1112, + "1113" => 1113, + "1114" => 1114, + "1115" => 1115, + "1116" => 1116, + "1117" => 1117, + "1118" => 1118, + "1119" => 1119, + "1120" => 1120, + "1121" => 1121, + "1122" => 1122, + "1123" => 1123, + "1124" => 1124, + "1125" => 1125, + "1126" => 1126, + "1127" => 1127, + "1128" => 1128, + "1129" => 1129, + "1130" => 1130, + "1131" => 1131, + "1132" => 1132, + "1133" => 1133, + "1134" => 1134, + "1135" => 1135, + "1136" => 1136, + "1137" => 1137, + "1138" => 1138, + "1139" => 1139, + "1140" => 1140, + "1141" => 1141, + "1142" => 1142, + "1143" => 1143, + "1144" => 1144, + "1145" => 1145, + "1146" => 1146, + "1147" => 1147, + "1148" => 1148, + "1149" => 1149, + "1150" => 1150, + "1151" => 1151, + "1152" => 1152, + "1153" => 1153, + "1154" => 1154, + "1155" => 1155, + "1156" => 1156, + "1157" => 1157, + "1158" => 1158, + "1159" => 1159, + "1160" => 1160, + "1161" => 1161, + "1162" => 1162, + "1163" => 1163, + "1164" => 1164, + "1165" => 1165, + "1166" => 1166, + "1167" => 1167, + "1168" => 1168, + "1169" => 1169, + "1170" => 1170, + "1171" => 1171, + "1172" => 1172, + "1173" => 1173, + "1174" => 1174, + "1175" => 1175, + "1176" => 1176, + "1177" => 1177, + "1178" => 1178, + "1179" => 1179, + "1180" => 1180, + "1181" => 1181, + "1182" => 1182, + "1183" => 1183, + "1184" => 1184, + "1185" => 1185, + "1186" => 1186, + "1187" => 1187, + "1188" => 1188, + "1189" => 1189, + "1190" => 1190, + "1191" => 1191, + "1192" => 1192, + "1193" => 1193, + "1194" => 1194, + "1195" => 1195, + "1196" => 1196, + "1197" => 1197, + "1198" => 1198, + "1199" => 1199, + "1200" => 1200, + "1201" => 1201, + "1202" => 1202, + "1203" => 1203, + "1204" => 1204, + "1205" => 1205, + "1206" => 1206, + "1207" => 1207, + "1208" => 1208, + "1209" => 1209, + "1210" => 1210, + "1211" => 1211, + "1212" => 1212, + "1213" => 1213, + "1214" => 1214, + "1215" => 1215, + "1216" => 1216, + "1217" => 1217, + "1218" => 1218, + "1219" => 1219, + "1220" => 1220, + "1221" => 1221, + "1222" => 1222, + "1223" => 1223, + "1224" => 1224, + "1225" => 1225, + "1226" => 1226, + "1227" => 1227, + "1228" => 1228, + "1229" => 1229, + "1230" => 1230, + "1231" => 1231, + "1232" => 1232, + "1233" => 1233, + "1234" => 1234, + "1235" => 1235, + "1236" => 1236, + "1237" => 1237, + "1238" => 1238, + "1239" => 1239, + "1240" => 1240, + "1241" => 1241, + "1242" => 1242, + "1243" => 1243, + "1244" => 1244, + "1245" => 1245, + "1246" => 1246, + "1247" => 1247, + "1248" => 1248, + "1249" => 1249, + "1250" => 1250, + "1251" => 1251, + "1252" => 1252, + "1253" => 1253, + "1254" => 1254, + "1255" => 1255, + "1256" => 1256, + "1257" => 1257, + "1258" => 1258, + "1259" => 1259, + "1260" => 1260, + "1261" => 1261, + "1262" => 1262, + "1263" => 1263, + "1264" => 1264, + "1265" => 1265, + "1266" => 1266, + "1267" => 1267, + "1268" => 1268, + "1269" => 1269, + "1270" => 1270, + "1271" => 1271, + "1272" => 1272, + "1273" => 1273, + "1274" => 1274, + "1275" => 1275, + "1276" => 1276, + "1277" => 1277, + "1278" => 1278, + "1279" => 1279, + "1280" => 1280, + "1281" => 1281, + "1282" => 1282, + "1283" => 1283, + "1284" => 1284, + "1285" => 1285, + "1286" => 1286, + "1287" => 1287, + "1288" => 1288, + "1289" => 1289, + "1290" => 1290, + "1291" => 1291, + "1292" => 1292, + "1293" => 1293, + "1294" => 1294, + "1295" => 1295, + "1296" => 1296, + "1297" => 1297, + "1298" => 1298, + "1299" => 1299, + "1300" => 1300, + "1301" => 1301, + "1302" => 1302, + "1303" => 1303, + "1304" => 1304, + "1305" => 1305, + "1306" => 1306, + "1307" => 1307, + "1308" => 1308, + "1309" => 1309, + "1310" => 1310, + "1311" => 1311, + "1312" => 1312, + "1313" => 1313, + "1314" => 1314, + "1315" => 1315, + "1316" => 1316, + "1317" => 1317, + "1318" => 1318, + "1319" => 1319, + "1320" => 1320, + "1321" => 1321, + "1322" => 1322, + "1323" => 1323, + "1324" => 1324, + "1325" => 1325, + "1326" => 1326, + "1327" => 1327, + "1328" => 1328, + "1329" => 1329, + "1330" => 1330, + "1331" => 1331, + "1332" => 1332, + "1333" => 1333, + "1334" => 1334, + "1335" => 1335, + "1336" => 1336, + "1337" => 1337, + "1338" => 1338, + "1339" => 1339, + "1340" => 1340, + "1341" => 1341, + "1342" => 1342, + "1343" => 1343, + "1344" => 1344, + "1345" => 1345, + "1346" => 1346, + "1347" => 1347, + "1348" => 1348, + "1349" => 1349, + "1350" => 1350, + "1351" => 1351, + "1352" => 1352, + "1353" => 1353, + "1354" => 1354, + "1355" => 1355, + "1356" => 1356, + "1357" => 1357, + "1358" => 1358, + "1359" => 1359, + "1360" => 1360, + "1361" => 1361, + "1362" => 1362, + "1363" => 1363, + "1364" => 1364, + "1365" => 1365, + "1366" => 1366, + "1367" => 1367, + "1368" => 1368, + "1369" => 1369, + "1370" => 1370, + "1371" => 1371, + "1372" => 1372, + "1373" => 1373, + "1374" => 1374, + "1375" => 1375, + "1376" => 1376, + "1377" => 1377, + "1378" => 1378, + "1379" => 1379, + "1380" => 1380, + "1381" => 1381, + "1382" => 1382, + "1383" => 1383, + "1384" => 1384, + "1385" => 1385, + "1386" => 1386, + "1387" => 1387, + "1388" => 1388, + "1389" => 1389, + "1390" => 1390, + "1391" => 1391, + "1392" => 1392, + "1393" => 1393, + "1394" => 1394, + "1395" => 1395, + "1396" => 1396, + "1397" => 1397, + "1398" => 1398, + "1399" => 1399, + "1400" => 1400, + "1401" => 1401, + "1402" => 1402, + "1403" => 1403, + "1404" => 1404, + "1405" => 1405, + "1406" => 1406, + "1407" => 1407, + "1408" => 1408, + "1409" => 1409, + "1410" => 1410, + "1411" => 1411, + "1412" => 1412, + "1413" => 1413, + "1414" => 1414, + "1415" => 1415, + "1416" => 1416, + "1417" => 1417, + "1418" => 1418, + "1419" => 1419, + "1420" => 1420, + "1421" => 1421, + "1422" => 1422, + "1423" => 1423, + "1424" => 1424, + "1425" => 1425, + "1426" => 1426, + "1427" => 1427, + "1428" => 1428, + "1429" => 1429, + "1430" => 1430, + "1431" => 1431, + "1432" => 1432, + "1433" => 1433, + "1434" => 1434, + "1435" => 1435, + "1436" => 1436, + "1437" => 1437, + "1438" => 1438, + "1439" => 1439, + "1440" => 1440, + "1441" => 1441, + "1442" => 1442, + "1443" => 1443, + "1444" => 1444, + "1445" => 1445, + "1446" => 1446, + "1447" => 1447, + "1448" => 1448, + "1449" => 1449, + "1450" => 1450, + "1451" => 1451, + "1452" => 1452, + "1453" => 1453, + "1454" => 1454, + "1455" => 1455, + "1456" => 1456, + "1457" => 1457, + "1458" => 1458, + "1459" => 1459, + "1460" => 1460, + "1461" => 1461, + "1462" => 1462, + "1463" => 1463, + "1464" => 1464, + "1465" => 1465, + "1466" => 1466, + "1467" => 1467, + "1468" => 1468, + "1469" => 1469, + "1470" => 1470, + "1471" => 1471, + "1472" => 1472, + "1473" => 1473, + "1474" => 1474, + "1475" => 1475, + "1476" => 1476, + "1477" => 1477, + "1478" => 1478, + "1479" => 1479, + "1480" => 1480, + "1481" => 1481, + "1482" => 1482, + "1483" => 1483, + "1484" => 1484, + "1485" => 1485, + "1486" => 1486, + "1487" => 1487, + "1488" => 1488, + "1489" => 1489, + "1490" => 1490, + "1491" => 1491, + "1492" => 1492, + "1493" => 1493, + "1494" => 1494, + "1495" => 1495, + "1496" => 1496, + "1497" => 1497, + "1498" => 1498, + "1499" => 1499, + "1500" => 1500, + "1501" => 1501, + "1502" => 1502, + "1503" => 1503, + "1504" => 1504, + "1505" => 1505, + "1506" => 1506, + "1507" => 1507, + "1508" => 1508, + "1509" => 1509, + "1510" => 1510, + "1511" => 1511, + "1512" => 1512, + "1513" => 1513, + "1514" => 1514, + "1515" => 1515, + "1516" => 1516, + "1517" => 1517, + "1518" => 1518, + "1519" => 1519, + "1520" => 1520, + "1521" => 1521, + "1522" => 1522, + "1523" => 1523, + "1524" => 1524, + "1525" => 1525, + "1526" => 1526, + "1527" => 1527, + "1528" => 1528, + "1529" => 1529, + "1530" => 1530, + "1531" => 1531, + "1532" => 1532, + "1533" => 1533, + "1534" => 1534, + "1535" => 1535, + "1536" => 1536, + "1537" => 1537, + "1538" => 1538, + "1539" => 1539, + "1540" => 1540, + "1541" => 1541, + "1542" => 1542, + "1543" => 1543, + "1544" => 1544, + "1545" => 1545, + "1546" => 1546, + "1547" => 1547, + "1548" => 1548, + "1549" => 1549, + "1550" => 1550, + "1551" => 1551, + "1552" => 1552, + "1553" => 1553, + "1554" => 1554, + "1555" => 1555, + "1556" => 1556, + "1557" => 1557, + "1558" => 1558, + "1559" => 1559, + "1560" => 1560, + "1561" => 1561, + "1562" => 1562, + "1563" => 1563, + "1564" => 1564, + "1565" => 1565, + "1566" => 1566, + "1567" => 1567, + "1568" => 1568, + "1569" => 1569, + "1570" => 1570, + "1571" => 1571, + "1572" => 1572, + "1573" => 1573, + "1574" => 1574, + "1575" => 1575, + "1576" => 1576, + "1577" => 1577, + "1578" => 1578, + "1579" => 1579, + "1580" => 1580, + "1581" => 1581, + "1582" => 1582, + "1583" => 1583, + "1584" => 1584, + "1585" => 1585, + "1586" => 1586, + "1587" => 1587, + "1588" => 1588, + "1589" => 1589, + "1590" => 1590, + "1591" => 1591, + "1592" => 1592, + "1593" => 1593, + "1594" => 1594, + "1595" => 1595, + "1596" => 1596, + "1597" => 1597, + "1598" => 1598, + "1599" => 1599, + "1600" => 1600, + "1601" => 1601, + "1602" => 1602, + "1603" => 1603, + "1604" => 1604, + "1605" => 1605, + "1606" => 1606, + "1607" => 1607, + "1608" => 1608, + "1609" => 1609, + "1610" => 1610, + "1611" => 1611, + "1612" => 1612, + "1613" => 1613, + "1614" => 1614, + "1615" => 1615, + "1616" => 1616, + "1617" => 1617, + "1618" => 1618, + "1619" => 1619, + "1620" => 1620, + "1621" => 1621, + "1622" => 1622, + "1623" => 1623, + "1624" => 1624, + "1625" => 1625, + "1626" => 1626, + "1627" => 1627, + "1628" => 1628, + "1629" => 1629, + "1630" => 1630, + "1631" => 1631, + "1632" => 1632, + "1633" => 1633, + "1634" => 1634, + "1635" => 1635, + "1636" => 1636, + "1637" => 1637, + "1638" => 1638, + "1639" => 1639, + "1640" => 1640, + "1641" => 1641, + "1642" => 1642, + "1643" => 1643, + "1644" => 1644, + "1645" => 1645, + "1646" => 1646, + "1647" => 1647, + "1648" => 1648, + "1649" => 1649, + "1650" => 1650, + "1651" => 1651, + "1652" => 1652, + "1653" => 1653, + "1654" => 1654, + "1655" => 1655, + "1656" => 1656, + "1657" => 1657, + "1658" => 1658, + "1659" => 1659, + "1660" => 1660, + "1661" => 1661, + "1662" => 1662, + "1663" => 1663, + "1664" => 1664, + "1665" => 1665, + "1666" => 1666, + "1667" => 1667, + "1668" => 1668, + "1669" => 1669, + "1670" => 1670, + "1671" => 1671, + "1672" => 1672, + "1673" => 1673, + "1674" => 1674, + "1675" => 1675, + "1676" => 1676, + "1677" => 1677, + "1678" => 1678, + "1679" => 1679, + "1680" => 1680, + "1681" => 1681, + "1682" => 1682, + "1683" => 1683, + "1684" => 1684, + "1685" => 1685, + "1686" => 1686, + "1687" => 1687, + "1688" => 1688, + "1689" => 1689, + "1690" => 1690, + "1691" => 1691, + "1692" => 1692, + "1693" => 1693, + "1694" => 1694, + "1695" => 1695, + "1696" => 1696, + "1697" => 1697, + "1698" => 1698, + "1699" => 1699, + "1700" => 1700, + "1701" => 1701, + "1702" => 1702, + "1703" => 1703, + "1704" => 1704, + "1705" => 1705, + "1706" => 1706, + "1707" => 1707, + "1708" => 1708, + "1709" => 1709, + "1710" => 1710, + "1711" => 1711, + "1712" => 1712, + "1713" => 1713, + "1714" => 1714, + "1715" => 1715, + "1716" => 1716, + "1717" => 1717, + "1718" => 1718, + "1719" => 1719, + "1720" => 1720, + "1721" => 1721, + "1722" => 1722, + "1723" => 1723, + "1724" => 1724, + "1725" => 1725, + "1726" => 1726, + "1727" => 1727, + "1728" => 1728, + "1729" => 1729, + "1730" => 1730, + "1731" => 1731, + "1732" => 1732, + "1733" => 1733, + "1734" => 1734, + "1735" => 1735, + "1736" => 1736, + "1737" => 1737, + "1738" => 1738, + "1739" => 1739, + "1740" => 1740, + "1741" => 1741, + "1742" => 1742, + "1743" => 1743, + "1744" => 1744, + "1745" => 1745, + "1746" => 1746, + "1747" => 1747, + "1748" => 1748, + "1749" => 1749, + "1750" => 1750, + "1751" => 1751, + "1752" => 1752, + "1753" => 1753, + "1754" => 1754, + "1755" => 1755, + "1756" => 1756, + "1757" => 1757, + "1758" => 1758, + "1759" => 1759, + "1760" => 1760, + "1761" => 1761, + "1762" => 1762, + "1763" => 1763, + "1764" => 1764, + "1765" => 1765, + "1766" => 1766, + "1767" => 1767, + "1768" => 1768, + "1769" => 1769, + "1770" => 1770, + "1771" => 1771, + "1772" => 1772, + "1773" => 1773, + "1774" => 1774, + "1775" => 1775, + "1776" => 1776, + "1777" => 1777, + "1778" => 1778, + "1779" => 1779, + "1780" => 1780, + "1781" => 1781, + "1782" => 1782, + "1783" => 1783, + "1784" => 1784, + "1785" => 1785, + "1786" => 1786, + "1787" => 1787, + "1788" => 1788, + "1789" => 1789, + "1790" => 1790, + "1791" => 1791, + "1792" => 1792, + "1793" => 1793, + "1794" => 1794, + "1795" => 1795, + "1796" => 1796, + "1797" => 1797, + "1798" => 1798, + "1799" => 1799, + "1800" => 1800, + "1801" => 1801, + "1802" => 1802, + "1803" => 1803, + "1804" => 1804, + "1805" => 1805, + "1806" => 1806, + "1807" => 1807, + "1808" => 1808, + "1809" => 1809, + "1810" => 1810, + "1811" => 1811, + "1812" => 1812, + "1813" => 1813, + "1814" => 1814, + "1815" => 1815, + "1816" => 1816, + "1817" => 1817, + "1818" => 1818, + "1819" => 1819, + "1820" => 1820, + "1821" => 1821, + "1822" => 1822, + "1823" => 1823, + "1824" => 1824, + "1825" => 1825, + "1826" => 1826, + "1827" => 1827, + "1828" => 1828, + "1829" => 1829, + "1830" => 1830, + "1831" => 1831, + "1832" => 1832, + "1833" => 1833, + "1834" => 1834, + "1835" => 1835, + "1836" => 1836, + "1837" => 1837, + "1838" => 1838, + "1839" => 1839, + "1840" => 1840, + "1841" => 1841, + "1842" => 1842, + "1843" => 1843, + "1844" => 1844, + "1845" => 1845, + "1846" => 1846, + "1847" => 1847, + "1848" => 1848, + "1849" => 1849, + "1850" => 1850, + "1851" => 1851, + "1852" => 1852, + "1853" => 1853, + "1854" => 1854, + "1855" => 1855, + "1856" => 1856, + "1857" => 1857, + "1858" => 1858, + "1859" => 1859, + "1860" => 1860, + "1861" => 1861, + "1862" => 1862, + "1863" => 1863, + "1864" => 1864, + "1865" => 1865, + "1866" => 1866, + "1867" => 1867, + "1868" => 1868, + "1869" => 1869, + "1870" => 1870, + "1871" => 1871, + "1872" => 1872, + "1873" => 1873, + "1874" => 1874, + "1875" => 1875, + "1876" => 1876, + "1877" => 1877, + "1878" => 1878, + "1879" => 1879, + "1880" => 1880, + "1881" => 1881, + "1882" => 1882, + "1883" => 1883, + "1884" => 1884, + "1885" => 1885, + "1886" => 1886, + "1887" => 1887, + "1888" => 1888, + "1889" => 1889, + "1890" => 1890, + "1891" => 1891, + "1892" => 1892, + "1893" => 1893, + "1894" => 1894, + "1895" => 1895, + "1896" => 1896, + "1897" => 1897, + "1898" => 1898, + "1899" => 1899, + "1900" => 1900, + "1901" => 1901, + "1902" => 1902, + "1903" => 1903, + "1904" => 1904, + "1905" => 1905, + "1906" => 1906, + "1907" => 1907, + "1908" => 1908, + "1909" => 1909, + "1910" => 1910, + "1911" => 1911, + "1912" => 1912, + "1913" => 1913, + "1914" => 1914, + "1915" => 1915, + "1916" => 1916, + "1917" => 1917, + "1918" => 1918, + "1919" => 1919, + "1920" => 1920, + "1921" => 1921, + "1922" => 1922, + "1923" => 1923, + "1924" => 1924, + "1925" => 1925, + "1926" => 1926, + "1927" => 1927, + "1928" => 1928, + "1929" => 1929, + "1930" => 1930, + "1931" => 1931, + "1932" => 1932, + "1933" => 1933, + "1934" => 1934, + "1935" => 1935, + "1936" => 1936, + "1937" => 1937, + "1938" => 1938, + "1939" => 1939, + "1940" => 1940, + "1941" => 1941, + "1942" => 1942, + "1943" => 1943, + "1944" => 1944, + "1945" => 1945, + "1946" => 1946, + "1947" => 1947, + "1948" => 1948, + "1949" => 1949, + "1950" => 1950, + "1951" => 1951, + "1952" => 1952, + "1953" => 1953, + "1954" => 1954, + "1955" => 1955, + "1956" => 1956, + "1957" => 1957, + "1958" => 1958, + "1959" => 1959, + "1960" => 1960, + "1961" => 1961, + "1962" => 1962, + "1963" => 1963, + "1964" => 1964, + "1965" => 1965, + "1966" => 1966, + "1967" => 1967, + "1968" => 1968, + "1969" => 1969, + "1970" => 1970, + "1971" => 1971, + "1972" => 1972, + "1973" => 1973, + "1974" => 1974, + "1975" => 1975, + "1976" => 1976, + "1977" => 1977, + "1978" => 1978, + "1979" => 1979, + "1980" => 1980, + "1981" => 1981, + "1982" => 1982, + "1983" => 1983, + "1984" => 1984, + "1985" => 1985, + "1986" => 1986, + "1987" => 1987, + "1988" => 1988, + "1989" => 1989, + "1990" => 1990, + "1991" => 1991, + "1992" => 1992, + "1993" => 1993, + "1994" => 1994, + "1995" => 1995, + "1996" => 1996, + "1997" => 1997, + "1998" => 1998, + "1999" => 1999, + "2000" => 2000, + "2001" => 2001, + "2002" => 2002, + "2003" => 2003, + "2004" => 2004, + "2005" => 2005, + "2006" => 2006, + "2007" => 2007, + "2008" => 2008, + "2009" => 2009, + "2010" => 2010, + "2011" => 2011, + "2012" => 2012, + "2013" => 2013, + "2014" => 2014, + "2015" => 2015, + "2016" => 2016, + "2017" => 2017, + "2018" => 2018, + "2019" => 2019, + "2020" => 2020, + "2021" => 2021, + "2022" => 2022, + "2023" => 2023, + "2024" => 2024, + "2025" => 2025, + "2026" => 2026, + "2027" => 2027, + "2028" => 2028, + "2029" => 2029, + "2030" => 2030, + "2031" => 2031, + "2032" => 2032, + "2033" => 2033, + "2034" => 2034, + "2035" => 2035, + "2036" => 2036, + "2037" => 2037, + "2038" => 2038, + "2039" => 2039, + "2040" => 2040, + "2041" => 2041, + "2042" => 2042, + "2043" => 2043, + "2044" => 2044, + "2045" => 2045, + "2046" => 2046, + "2047" => 2047, + "2048" => 2048, + "2049" => 2049, + "2050" => 2050, + "2051" => 2051, + "2052" => 2052, + "2053" => 2053, + "2054" => 2054, + "2055" => 2055, + "2056" => 2056, + "2057" => 2057, + "2058" => 2058, + "2059" => 2059, + "2060" => 2060, + "2061" => 2061, + "2062" => 2062, + "2063" => 2063, + "2064" => 2064, + "2065" => 2065, + "2066" => 2066, + "2067" => 2067, + "2068" => 2068, + "2069" => 2069, + "2070" => 2070, + "2071" => 2071, + "2072" => 2072, + "2073" => 2073, + "2074" => 2074, + "2075" => 2075, + "2076" => 2076, + "2077" => 2077, + "2078" => 2078, + "2079" => 2079, + "2080" => 2080, + "2081" => 2081, + "2082" => 2082, + "2083" => 2083, + "2084" => 2084, + "2085" => 2085, + "2086" => 2086, + "2087" => 2087, + "2088" => 2088, + "2089" => 2089, + "2090" => 2090, + "2091" => 2091, + "2092" => 2092, + "2093" => 2093, + "2094" => 2094, + "2095" => 2095, + "2096" => 2096, + "2097" => 2097, + "2098" => 2098, + "2099" => 2099, + "2100" => 2100, + "2101" => 2101, + "2102" => 2102, + "2103" => 2103, + "2104" => 2104, + "2105" => 2105, + "2106" => 2106, + "2107" => 2107, + "2108" => 2108, + "2109" => 2109, + "2110" => 2110, + "2111" => 2111, + "2112" => 2112, + "2113" => 2113, + "2114" => 2114, + "2115" => 2115, + "2116" => 2116, + "2117" => 2117, + "2118" => 2118, + "2119" => 2119, + "2120" => 2120, + "2121" => 2121, + "2122" => 2122, + "2123" => 2123, + "2124" => 2124, + "2125" => 2125, + "2126" => 2126, + "2127" => 2127, + "2128" => 2128, + "2129" => 2129, + "2130" => 2130, + "2131" => 2131, + "2132" => 2132, + "2133" => 2133, + "2134" => 2134, + "2135" => 2135, + "2136" => 2136, + "2137" => 2137, + "2138" => 2138, + "2139" => 2139, + "2140" => 2140, + "2141" => 2141, + "2142" => 2142, + "2143" => 2143, + "2144" => 2144, + "2145" => 2145, + "2146" => 2146, + "2147" => 2147, + "2148" => 2148, + "2149" => 2149, + "2150" => 2150, + "2151" => 2151, + "2152" => 2152, + "2153" => 2153, + "2154" => 2154, + "2155" => 2155, + "2156" => 2156, + "2157" => 2157, + "2158" => 2158, + "2159" => 2159, + "2160" => 2160, + "2161" => 2161, + "2162" => 2162, + "2163" => 2163, + "2164" => 2164, + "2165" => 2165, + "2166" => 2166, + "2167" => 2167, + "2168" => 2168, + "2169" => 2169, + "2170" => 2170, + "2171" => 2171, + "2172" => 2172, + "2173" => 2173, + "2174" => 2174, + "2175" => 2175, + "2176" => 2176, + "2177" => 2177, + "2178" => 2178, + "2179" => 2179, + "2180" => 2180, + "2181" => 2181, + "2182" => 2182, + "2183" => 2183, + "2184" => 2184, + "2185" => 2185, + "2186" => 2186, + "2187" => 2187, + "2188" => 2188, + "2189" => 2189, + "2190" => 2190, + "2191" => 2191, + "2192" => 2192, + "2193" => 2193, + "2194" => 2194, + "2195" => 2195, + "2196" => 2196, + "2197" => 2197, + "2198" => 2198, + "2199" => 2199, + "2200" => 2200, + "2201" => 2201, + "2202" => 2202, + "2203" => 2203, + "2204" => 2204, + "2205" => 2205, + "2206" => 2206, + "2207" => 2207, + "2208" => 2208, + "2209" => 2209, + "2210" => 2210, + "2211" => 2211, + "2212" => 2212, + "2213" => 2213, + "2214" => 2214, + "2215" => 2215, + "2216" => 2216, + "2217" => 2217, + "2218" => 2218, + "2219" => 2219, + "2220" => 2220, + "2221" => 2221, + "2222" => 2222, + "2223" => 2223, + "2224" => 2224, + "2225" => 2225, + "2226" => 2226, + "2227" => 2227, + "2228" => 2228, + "2229" => 2229, + "2230" => 2230, + "2231" => 2231, + "2232" => 2232, + "2233" => 2233, + "2234" => 2234, + "2235" => 2235, + "2236" => 2236, + "2237" => 2237, + "2238" => 2238, + "2239" => 2239, + "2240" => 2240, + "2241" => 2241, + "2242" => 2242, + "2243" => 2243, + "2244" => 2244, + "2245" => 2245, + "2246" => 2246, + "2247" => 2247, + "2248" => 2248, + "2249" => 2249, + "2250" => 2250, + "2251" => 2251, + "2252" => 2252, + "2253" => 2253, + "2254" => 2254, + "2255" => 2255, + "2256" => 2256, + "2257" => 2257, + "2258" => 2258, + "2259" => 2259, + "2260" => 2260, + "2261" => 2261, + "2262" => 2262, + "2263" => 2263, + "2264" => 2264, + "2265" => 2265, + "2266" => 2266, + "2267" => 2267, + "2268" => 2268, + "2269" => 2269, + "2270" => 2270, + "2271" => 2271, + "2272" => 2272, + "2273" => 2273, + "2274" => 2274, + "2275" => 2275, + "2276" => 2276, + "2277" => 2277, + "2278" => 2278, + "2279" => 2279, + "2280" => 2280, + "2281" => 2281, + "2282" => 2282, + "2283" => 2283, + "2284" => 2284, + "2285" => 2285, + "2286" => 2286, + "2287" => 2287, + "2288" => 2288, + "2289" => 2289, + "2290" => 2290, + "2291" => 2291, + "2292" => 2292, + "2293" => 2293, + "2294" => 2294, + "2295" => 2295, + "2296" => 2296, + "2297" => 2297, + "2298" => 2298, + "2299" => 2299, + "2300" => 2300, + "2301" => 2301, + "2302" => 2302, + "2303" => 2303, + "2304" => 2304, + "2305" => 2305, + "2306" => 2306, + "2307" => 2307, + "2308" => 2308, + "2309" => 2309, + "2310" => 2310, + "2311" => 2311, + "2312" => 2312, + "2313" => 2313, + "2314" => 2314, + "2315" => 2315, + "2316" => 2316, + "2317" => 2317, + "2318" => 2318, + "2319" => 2319, + "2320" => 2320, + "2321" => 2321, + "2322" => 2322, + "2323" => 2323, + "2324" => 2324, + "2325" => 2325, + "2326" => 2326, + "2327" => 2327, + "2328" => 2328, + "2329" => 2329, + "2330" => 2330, + "2331" => 2331, + "2332" => 2332, + "2333" => 2333, + "2334" => 2334, + "2335" => 2335, + "2336" => 2336, + "2337" => 2337, + "2338" => 2338, + "2339" => 2339, + "2340" => 2340, + "2341" => 2341, + "2342" => 2342, + "2343" => 2343, + "2344" => 2344, + "2345" => 2345, + "2346" => 2346, + "2347" => 2347, + "2348" => 2348, + "2349" => 2349, + "2350" => 2350, + "2351" => 2351, + "2352" => 2352, + "2353" => 2353, + "2354" => 2354, + "2355" => 2355, + "2356" => 2356, + "2357" => 2357, + "2358" => 2358, + "2359" => 2359, + "2360" => 2360, + "2361" => 2361, + "2362" => 2362, + "2363" => 2363, + "2364" => 2364, + "2365" => 2365, + "2366" => 2366, + "2367" => 2367, + "2368" => 2368, + "2369" => 2369, + "2370" => 2370, + "2371" => 2371, + "2372" => 2372, + "2373" => 2373, + "2374" => 2374, + "2375" => 2375, + "2376" => 2376, + "2377" => 2377, + "2378" => 2378, + "2379" => 2379, + "2380" => 2380, + "2381" => 2381, + "2382" => 2382, + "2383" => 2383, + "2384" => 2384, + "2385" => 2385, + "2386" => 2386, + "2387" => 2387, + "2388" => 2388, + "2389" => 2389, + "2390" => 2390, + "2391" => 2391, + "2392" => 2392, + "2393" => 2393, + "2394" => 2394, + "2395" => 2395, + "2396" => 2396, + "2397" => 2397, + "2398" => 2398, + "2399" => 2399, + "2400" => 2400, + "2401" => 2401, + "2402" => 2402, + "2403" => 2403, + "2404" => 2404, + "2405" => 2405, + "2406" => 2406, + "2407" => 2407, + "2408" => 2408, + "2409" => 2409, + "2410" => 2410, + "2411" => 2411, + "2412" => 2412, + "2413" => 2413, + "2414" => 2414, + "2415" => 2415, + "2416" => 2416, + "2417" => 2417, + "2418" => 2418, + "2419" => 2419, + "2420" => 2420, + "2421" => 2421, + "2422" => 2422, + "2423" => 2423, + "2424" => 2424, + "2425" => 2425, + "2426" => 2426, + "2427" => 2427, + "2428" => 2428, + "2429" => 2429, + "2430" => 2430, + "2431" => 2431, + "2432" => 2432, + "2433" => 2433, + "2434" => 2434, + "2435" => 2435, + "2436" => 2436, + "2437" => 2437, + "2438" => 2438, + "2439" => 2439, + "2440" => 2440, + "2441" => 2441, + "2442" => 2442, + "2443" => 2443, + "2444" => 2444, + "2445" => 2445, + "2446" => 2446, + "2447" => 2447, + "2448" => 2448, + "2449" => 2449, + "2450" => 2450, + "2451" => 2451, + "2452" => 2452, + "2453" => 2453, + "2454" => 2454, + "2455" => 2455, + "2456" => 2456, + "2457" => 2457, + "2458" => 2458, + "2459" => 2459, + "2460" => 2460, + "2461" => 2461, + "2462" => 2462, + "2463" => 2463, + "2464" => 2464, + "2465" => 2465, + "2466" => 2466, + "2467" => 2467, + "2468" => 2468, + "2469" => 2469, + "2470" => 2470, + "2471" => 2471, + "2472" => 2472, + "2473" => 2473, + "2474" => 2474, + "2475" => 2475, + "2476" => 2476, + "2477" => 2477, + "2478" => 2478, + "2479" => 2479, + "2480" => 2480, + "2481" => 2481, + "2482" => 2482, + "2483" => 2483, + "2484" => 2484, + "2485" => 2485, + "2486" => 2486, + "2487" => 2487, + "2488" => 2488, + "2489" => 2489, + "2490" => 2490, + "2491" => 2491, + "2492" => 2492, + "2493" => 2493, + "2494" => 2494, + "2495" => 2495, + "2496" => 2496, + "2497" => 2497, + "2498" => 2498, + "2499" => 2499, + "2500" => 2500, + "2501" => 2501, + "2502" => 2502, + "2503" => 2503, + "2504" => 2504, + "2505" => 2505, + "2506" => 2506, + "2507" => 2507, + "2508" => 2508, + "2509" => 2509, + "2510" => 2510, + "2511" => 2511, + "2512" => 2512, + "2513" => 2513, + "2514" => 2514, + "2515" => 2515, + "2516" => 2516, + "2517" => 2517, + "2518" => 2518, + "2519" => 2519, + "2520" => 2520, + "2521" => 2521, + "2522" => 2522, + "2523" => 2523, + "2524" => 2524, + "2525" => 2525, + "2526" => 2526, + "2527" => 2527, + "2528" => 2528, + "2529" => 2529, + "2530" => 2530, + "2531" => 2531, + "2532" => 2532, + "2533" => 2533, + "2534" => 2534, + "2535" => 2535, + "2536" => 2536, + "2537" => 2537, + "2538" => 2538, + "2539" => 2539, + "2540" => 2540, + "2541" => 2541, + "2542" => 2542, + "2543" => 2543, + "2544" => 2544, + "2545" => 2545, + "2546" => 2546, + "2547" => 2547, + "2548" => 2548, + "2549" => 2549, + "2550" => 2550, + "2551" => 2551, + "2552" => 2552, + "2553" => 2553, + "2554" => 2554, + "2555" => 2555, + "2556" => 2556, + "2557" => 2557, + "2558" => 2558, + "2559" => 2559, + "2560" => 2560, + "2561" => 2561, + "2562" => 2562, + "2563" => 2563, + "2564" => 2564, + "2565" => 2565, + "2566" => 2566, + "2567" => 2567, + "2568" => 2568, + "2569" => 2569, + "2570" => 2570, + "2571" => 2571, + "2572" => 2572, + "2573" => 2573, + "2574" => 2574, + "2575" => 2575, + "2576" => 2576, + "2577" => 2577, + "2578" => 2578, + "2579" => 2579, + "2580" => 2580, + "2581" => 2581, + "2582" => 2582, + "2583" => 2583, + "2584" => 2584, + "2585" => 2585, + "2586" => 2586, + "2587" => 2587, + "2588" => 2588, + "2589" => 2589, + "2590" => 2590, + "2591" => 2591, + "2592" => 2592, + "2593" => 2593, + "2594" => 2594, + "2595" => 2595, + "2596" => 2596, + "2597" => 2597, + "2598" => 2598, + "2599" => 2599, + "2600" => 2600, + "2601" => 2601, + "2602" => 2602, + "2603" => 2603, + "2604" => 2604, + "2605" => 2605, + "2606" => 2606, + "2607" => 2607, + "2608" => 2608, + "2609" => 2609, + "2610" => 2610, + "2611" => 2611, + "2612" => 2612, + "2613" => 2613, + "2614" => 2614, + "2615" => 2615, + "2616" => 2616, + "2617" => 2617, + "2618" => 2618, + "2619" => 2619, + "2620" => 2620, + "2621" => 2621, + "2622" => 2622, + "2623" => 2623, + "2624" => 2624, + "2625" => 2625, + "2626" => 2626, + "2627" => 2627, + "2628" => 2628, + "2629" => 2629, + "2630" => 2630, + "2631" => 2631, + "2632" => 2632, + "2633" => 2633, + "2634" => 2634, + "2635" => 2635, + "2636" => 2636, + "2637" => 2637, + "2638" => 2638, + "2639" => 2639, + "2640" => 2640, + "2641" => 2641, + "2642" => 2642, + "2643" => 2643, + "2644" => 2644, + "2645" => 2645, + "2646" => 2646, + "2647" => 2647, + "2648" => 2648, + "2649" => 2649, + "2650" => 2650, + "2651" => 2651, + "2652" => 2652, + "2653" => 2653, + "2654" => 2654, + "2655" => 2655, + "2656" => 2656, + "2657" => 2657, + "2658" => 2658, + "2659" => 2659, + "2660" => 2660, + "2661" => 2661, + "2662" => 2662, + "2663" => 2663, + "2664" => 2664, + "2665" => 2665, + "2666" => 2666, + "2667" => 2667, + "2668" => 2668, + "2669" => 2669, + "2670" => 2670, + "2671" => 2671, + "2672" => 2672, + "2673" => 2673, + "2674" => 2674, + "2675" => 2675, + "2676" => 2676, + "2677" => 2677, + "2678" => 2678, + "2679" => 2679, + "2680" => 2680, + "2681" => 2681, + "2682" => 2682, + "2683" => 2683, + "2684" => 2684, + "2685" => 2685, + "2686" => 2686, + "2687" => 2687, + "2688" => 2688, + "2689" => 2689, + "2690" => 2690, + "2691" => 2691, + "2692" => 2692, + "2693" => 2693, + "2694" => 2694, + "2695" => 2695, + "2696" => 2696, + "2697" => 2697, + "2698" => 2698, + "2699" => 2699, + "2700" => 2700, + "2701" => 2701, + "2702" => 2702, + "2703" => 2703, + "2704" => 2704, + "2705" => 2705, + "2706" => 2706, + "2707" => 2707, + "2708" => 2708, + "2709" => 2709, + "2710" => 2710, + "2711" => 2711, + "2712" => 2712, + "2713" => 2713, + "2714" => 2714, + "2715" => 2715, + "2716" => 2716, + "2717" => 2717, + "2718" => 2718, + "2719" => 2719, + "2720" => 2720, + "2721" => 2721, + "2722" => 2722, + "2723" => 2723, + "2724" => 2724, + "2725" => 2725, + "2726" => 2726, + "2727" => 2727, + "2728" => 2728, + "2729" => 2729, + "2730" => 2730, + "2731" => 2731, + "2732" => 2732, + "2733" => 2733, + "2734" => 2734, + "2735" => 2735, + "2736" => 2736, + "2737" => 2737, + "2738" => 2738, + "2739" => 2739, + "2740" => 2740, + "2741" => 2741, + "2742" => 2742, + "2743" => 2743, + "2744" => 2744, + "2745" => 2745, + "2746" => 2746, + "2747" => 2747, + "2748" => 2748, + "2749" => 2749, + "2750" => 2750, + "2751" => 2751, + "2752" => 2752, + "2753" => 2753, + "2754" => 2754, + "2755" => 2755, + "2756" => 2756, + "2757" => 2757, + "2758" => 2758, + "2759" => 2759, + "2760" => 2760, + "2761" => 2761, + "2762" => 2762, + "2763" => 2763, + "2764" => 2764, + "2765" => 2765, + "2766" => 2766, + "2767" => 2767, + "2768" => 2768, + "2769" => 2769, + "2770" => 2770, + "2771" => 2771, + "2772" => 2772, + "2773" => 2773, + "2774" => 2774, + "2775" => 2775, + "2776" => 2776, + "2777" => 2777, + "2778" => 2778, + "2779" => 2779, + "2780" => 2780, + "2781" => 2781, + "2782" => 2782, + "2783" => 2783, + "2784" => 2784, + "2785" => 2785, + "2786" => 2786, + "2787" => 2787, + "2788" => 2788, + "2789" => 2789, + "2790" => 2790, + "2791" => 2791, + "2792" => 2792, + "2793" => 2793, + "2794" => 2794, + "2795" => 2795, + "2796" => 2796, + "2797" => 2797, + "2798" => 2798, + "2799" => 2799, + "2800" => 2800, + "2801" => 2801, + "2802" => 2802, + "2803" => 2803, + "2804" => 2804, + "2805" => 2805, + "2806" => 2806, + "2807" => 2807, + "2808" => 2808, + "2809" => 2809, + "2810" => 2810, + "2811" => 2811, + "2812" => 2812, + "2813" => 2813, + "2814" => 2814, + "2815" => 2815, + "2816" => 2816, + "2817" => 2817, + "2818" => 2818, + "2819" => 2819, + "2820" => 2820, + "2821" => 2821, + "2822" => 2822, + "2823" => 2823, + "2824" => 2824, + "2825" => 2825, + "2826" => 2826, + "2827" => 2827, + "2828" => 2828, + "2829" => 2829, + "2830" => 2830, + "2831" => 2831, + "2832" => 2832, + "2833" => 2833, + "2834" => 2834, + "2835" => 2835, + "2836" => 2836, + "2837" => 2837, + "2838" => 2838, + "2839" => 2839, + "2840" => 2840, + "2841" => 2841, + "2842" => 2842, + "2843" => 2843, + "2844" => 2844, + "2845" => 2845, + "2846" => 2846, + "2847" => 2847, + "2848" => 2848, + "2849" => 2849, + "2850" => 2850, + "2851" => 2851, + "2852" => 2852, + "2853" => 2853, + "2854" => 2854, + "2855" => 2855, + "2856" => 2856, + "2857" => 2857, + "2858" => 2858, + "2859" => 2859, + "2860" => 2860, + "2861" => 2861, + "2862" => 2862, + "2863" => 2863, + "2864" => 2864, + "2865" => 2865, + "2866" => 2866, + "2867" => 2867, + "2868" => 2868, + "2869" => 2869, + "2870" => 2870, + "2871" => 2871, + "2872" => 2872, + "2873" => 2873, + "2874" => 2874, + "2875" => 2875, + "2876" => 2876, + "2877" => 2877, + "2878" => 2878, + "2879" => 2879, + "2880" => 2880, + "2881" => 2881, + "2882" => 2882, + "2883" => 2883, + "2884" => 2884, + "2885" => 2885, + "2886" => 2886, + "2887" => 2887, + "2888" => 2888, + "2889" => 2889, + "2890" => 2890, + "2891" => 2891, + "2892" => 2892, + "2893" => 2893, + "2894" => 2894, + "2895" => 2895, + "2896" => 2896, + "2897" => 2897, + "2898" => 2898, + "2899" => 2899, + "2900" => 2900, + "2901" => 2901, + "2902" => 2902, + "2903" => 2903, + "2904" => 2904, + "2905" => 2905, + "2906" => 2906, + "2907" => 2907, + "2908" => 2908, + "2909" => 2909, + "2910" => 2910, + "2911" => 2911, + "2912" => 2912, + "2913" => 2913, + "2914" => 2914, + "2915" => 2915, + "2916" => 2916, + "2917" => 2917, + "2918" => 2918, + "2919" => 2919, + "2920" => 2920, + "2921" => 2921, + "2922" => 2922, + "2923" => 2923, + "2924" => 2924, + "2925" => 2925, + "2926" => 2926, + "2927" => 2927, + "2928" => 2928, + "2929" => 2929, + "2930" => 2930, + "2931" => 2931, + "2932" => 2932, + "2933" => 2933, + "2934" => 2934, + "2935" => 2935, + "2936" => 2936, + "2937" => 2937, + "2938" => 2938, + "2939" => 2939, + "2940" => 2940, + "2941" => 2941, + "2942" => 2942, + "2943" => 2943, + "2944" => 2944, + "2945" => 2945, + "2946" => 2946, + "2947" => 2947, + "2948" => 2948, + "2949" => 2949, + "2950" => 2950, + "2951" => 2951, + "2952" => 2952, + "2953" => 2953, + "2954" => 2954, + "2955" => 2955, + "2956" => 2956, + "2957" => 2957, + "2958" => 2958, + "2959" => 2959, + "2960" => 2960, + "2961" => 2961, + "2962" => 2962, + "2963" => 2963, + "2964" => 2964, + "2965" => 2965, + "2966" => 2966, + "2967" => 2967, + "2968" => 2968, + "2969" => 2969, + "2970" => 2970, + "2971" => 2971, + "2972" => 2972, + "2973" => 2973, + "2974" => 2974, + "2975" => 2975, + "2976" => 2976, + "2977" => 2977, + "2978" => 2978, + "2979" => 2979, + "2980" => 2980, + "2981" => 2981, + "2982" => 2982, + "2983" => 2983, + "2984" => 2984, + "2985" => 2985, + "2986" => 2986, + "2987" => 2987, + "2988" => 2988, + "2989" => 2989, + "2990" => 2990, + "2991" => 2991, + "2992" => 2992, + "2993" => 2993, + "2994" => 2994, + "2995" => 2995, + "2996" => 2996, + "2997" => 2997, + "2998" => 2998, + "2999" => 2999, + "3000" => 3000, + "3001" => 3001, + "3002" => 3002, + "3003" => 3003, + "3004" => 3004, + "3005" => 3005, + "3006" => 3006, + "3007" => 3007, + "3008" => 3008, + "3009" => 3009, + "3010" => 3010, + "3011" => 3011, + "3012" => 3012, + "3013" => 3013, + "3014" => 3014, + "3015" => 3015, + "3016" => 3016, + "3017" => 3017, + "3018" => 3018, + "3019" => 3019, + "3020" => 3020, + "3021" => 3021, + "3022" => 3022, + "3023" => 3023, + "3024" => 3024, + "3025" => 3025, + "3026" => 3026, + "3027" => 3027, + "3028" => 3028, + "3029" => 3029, + "3030" => 3030, + "3031" => 3031, + "3032" => 3032, + "3033" => 3033, + "3034" => 3034, + "3035" => 3035, + "3036" => 3036, + "3037" => 3037, + "3038" => 3038, + "3039" => 3039, + "3040" => 3040, + "3041" => 3041, + "3042" => 3042, + "3043" => 3043, + "3044" => 3044, + "3045" => 3045, + "3046" => 3046, + "3047" => 3047, + "3048" => 3048, + "3049" => 3049, + "3050" => 3050, + "3051" => 3051, + "3052" => 3052, + "3053" => 3053, + "3054" => 3054, + "3055" => 3055, + "3056" => 3056, + "3057" => 3057, + "3058" => 3058, + "3059" => 3059, + "3060" => 3060, + "3061" => 3061, + "3062" => 3062, + "3063" => 3063, + "3064" => 3064, + "3065" => 3065, + "3066" => 3066, + "3067" => 3067, + "3068" => 3068, + "3069" => 3069, + "3070" => 3070, + "3071" => 3071, + "3072" => 3072, + "3073" => 3073, + "3074" => 3074, + "3075" => 3075, + "3076" => 3076, + "3077" => 3077, + "3078" => 3078, + "3079" => 3079, + "3080" => 3080, + "3081" => 3081, + "3082" => 3082, + "3083" => 3083, + "3084" => 3084, + "3085" => 3085, + "3086" => 3086, + "3087" => 3087, + "3088" => 3088, + "3089" => 3089, + "3090" => 3090, + "3091" => 3091, + "3092" => 3092, + "3093" => 3093, + "3094" => 3094, + "3095" => 3095, + "3096" => 3096, + "3097" => 3097, + "3098" => 3098, + "3099" => 3099, + "3100" => 3100, + "3101" => 3101, + "3102" => 3102, + "3103" => 3103, + "3104" => 3104, + "3105" => 3105, + "3106" => 3106, + "3107" => 3107, + "3108" => 3108, + "3109" => 3109, + "3110" => 3110, + "3111" => 3111, + "3112" => 3112, + "3113" => 3113, + "3114" => 3114, + "3115" => 3115, + "3116" => 3116, + "3117" => 3117, + "3118" => 3118, + "3119" => 3119, + "3120" => 3120, + "3121" => 3121, + "3122" => 3122, + "3123" => 3123, + "3124" => 3124, + "3125" => 3125, + "3126" => 3126, + "3127" => 3127, + "3128" => 3128, + "3129" => 3129, + "3130" => 3130, + "3131" => 3131, + "3132" => 3132, + "3133" => 3133, + "3134" => 3134, + "3135" => 3135, + "3136" => 3136, + "3137" => 3137, + "3138" => 3138, + "3139" => 3139, + "3140" => 3140, + "3141" => 3141, + "3142" => 3142, + "3143" => 3143, + "3144" => 3144, + "3145" => 3145, + "3146" => 3146, + "3147" => 3147, + "3148" => 3148, + "3149" => 3149, + "3150" => 3150, + "3151" => 3151, + "3152" => 3152, + "3153" => 3153, + "3154" => 3154, + "3155" => 3155, + "3156" => 3156, + "3157" => 3157, + "3158" => 3158, + "3159" => 3159, + "3160" => 3160, + "3161" => 3161, + "3162" => 3162, + "3163" => 3163, + "3164" => 3164, + "3165" => 3165, + "3166" => 3166, + "3167" => 3167, + "3168" => 3168, + "3169" => 3169, + "3170" => 3170, + "3171" => 3171, + "3172" => 3172, + "3173" => 3173, + "3174" => 3174, + "3175" => 3175, + "3176" => 3176, + "3177" => 3177, + "3178" => 3178, + "3179" => 3179, + "3180" => 3180, + "3181" => 3181, + "3182" => 3182, + "3183" => 3183, + "3184" => 3184, + "3185" => 3185, + "3186" => 3186, + "3187" => 3187, + "3188" => 3188, + "3189" => 3189, + "3190" => 3190, + "3191" => 3191, + "3192" => 3192, + "3193" => 3193, + "3194" => 3194, + "3195" => 3195, + "3196" => 3196, + "3197" => 3197, + "3198" => 3198, + "3199" => 3199, + "3200" => 3200, + "3201" => 3201, + "3202" => 3202, + "3203" => 3203, + "3204" => 3204, + "3205" => 3205, + "3206" => 3206, + "3207" => 3207, + "3208" => 3208, + "3209" => 3209, + "3210" => 3210, + "3211" => 3211, + "3212" => 3212, + "3213" => 3213, + "3214" => 3214, + "3215" => 3215, + "3216" => 3216, + "3217" => 3217, + "3218" => 3218, + "3219" => 3219, + "3220" => 3220, + "3221" => 3221, + "3222" => 3222, + "3223" => 3223, + "3224" => 3224, + "3225" => 3225, + "3226" => 3226, + "3227" => 3227, + "3228" => 3228, + "3229" => 3229, + "3230" => 3230, + "3231" => 3231, + "3232" => 3232, + "3233" => 3233, + "3234" => 3234, + "3235" => 3235, + "3236" => 3236, + "3237" => 3237, + "3238" => 3238, + "3239" => 3239, + "3240" => 3240, + "3241" => 3241, + "3242" => 3242, + "3243" => 3243, + "3244" => 3244, + "3245" => 3245, + "3246" => 3246, + "3247" => 3247, + "3248" => 3248, + "3249" => 3249, + "3250" => 3250, + "3251" => 3251, + "3252" => 3252, + "3253" => 3253, + "3254" => 3254, + "3255" => 3255, + "3256" => 3256, + "3257" => 3257, + "3258" => 3258, + "3259" => 3259, + "3260" => 3260, + "3261" => 3261, + "3262" => 3262, + "3263" => 3263, + "3264" => 3264, + "3265" => 3265, + "3266" => 3266, + "3267" => 3267, + "3268" => 3268, + "3269" => 3269, + "3270" => 3270, + "3271" => 3271, + "3272" => 3272, + "3273" => 3273, + "3274" => 3274, + "3275" => 3275, + "3276" => 3276, + "3277" => 3277, + "3278" => 3278, + "3279" => 3279, + "3280" => 3280, + "3281" => 3281, + "3282" => 3282, + "3283" => 3283, + "3284" => 3284, + "3285" => 3285, + "3286" => 3286, + "3287" => 3287, + "3288" => 3288, + "3289" => 3289, + "3290" => 3290, + "3291" => 3291, + "3292" => 3292, + "3293" => 3293, + "3294" => 3294, + "3295" => 3295, + "3296" => 3296, + "3297" => 3297, + "3298" => 3298, + "3299" => 3299, + "3300" => 3300, + "3301" => 3301, + "3302" => 3302, + "3303" => 3303, + "3304" => 3304, + "3305" => 3305, + "3306" => 3306, + "3307" => 3307, + "3308" => 3308, + "3309" => 3309, + "3310" => 3310, + "3311" => 3311, + "3312" => 3312, + "3313" => 3313, + "3314" => 3314, + "3315" => 3315, + "3316" => 3316, + "3317" => 3317, + "3318" => 3318, + "3319" => 3319, + "3320" => 3320, + "3321" => 3321, + "3322" => 3322, + "3323" => 3323, + "3324" => 3324, + "3325" => 3325, + "3326" => 3326, + "3327" => 3327, + "3328" => 3328, + "3329" => 3329, + "3330" => 3330, + "3331" => 3331, + "3332" => 3332, + "3333" => 3333, + "3334" => 3334, + "3335" => 3335, + "3336" => 3336, + "3337" => 3337, + "3338" => 3338, + "3339" => 3339, + "3340" => 3340, + "3341" => 3341, + "3342" => 3342, + "3343" => 3343, + "3344" => 3344, + "3345" => 3345, + "3346" => 3346, + "3347" => 3347, + "3348" => 3348, + "3349" => 3349, + "3350" => 3350, + "3351" => 3351, + "3352" => 3352, + "3353" => 3353, + "3354" => 3354, + "3355" => 3355, + "3356" => 3356, + "3357" => 3357, + "3358" => 3358, + "3359" => 3359, + "3360" => 3360, + "3361" => 3361, + "3362" => 3362, + "3363" => 3363, + "3364" => 3364, + "3365" => 3365, + "3366" => 3366, + "3367" => 3367, + "3368" => 3368, + "3369" => 3369, + "3370" => 3370, + "3371" => 3371, + "3372" => 3372, + "3373" => 3373, + "3374" => 3374, + "3375" => 3375, + "3376" => 3376, + "3377" => 3377, + "3378" => 3378, + "3379" => 3379, + "3380" => 3380, + "3381" => 3381, + "3382" => 3382, + "3383" => 3383, + "3384" => 3384, + "3385" => 3385, + "3386" => 3386, + "3387" => 3387, + "3388" => 3388, + "3389" => 3389, + "3390" => 3390, + "3391" => 3391, + "3392" => 3392, + "3393" => 3393, + "3394" => 3394, + "3395" => 3395, + "3396" => 3396, + "3397" => 3397, + "3398" => 3398, + "3399" => 3399, + "3400" => 3400, + "3401" => 3401, + "3402" => 3402, + "3403" => 3403, + "3404" => 3404, + "3405" => 3405, + "3406" => 3406, + "3407" => 3407, + "3408" => 3408, + "3409" => 3409, + "3410" => 3410, + "3411" => 3411, + "3412" => 3412, + "3413" => 3413, + "3414" => 3414, + "3415" => 3415, + "3416" => 3416, + "3417" => 3417, + "3418" => 3418, + "3419" => 3419, + "3420" => 3420, + "3421" => 3421, + "3422" => 3422, + "3423" => 3423, + "3424" => 3424, + "3425" => 3425, + "3426" => 3426, + "3427" => 3427, + "3428" => 3428, + "3429" => 3429, + "3430" => 3430, + "3431" => 3431, + "3432" => 3432, + "3433" => 3433, + "3434" => 3434, + "3435" => 3435, + "3436" => 3436, + "3437" => 3437, + "3438" => 3438, + "3439" => 3439, + "3440" => 3440, + "3441" => 3441, + "3442" => 3442, + "3443" => 3443, + "3444" => 3444, + "3445" => 3445, + "3446" => 3446, + "3447" => 3447, + "3448" => 3448, + "3449" => 3449, + "3450" => 3450, + "3451" => 3451, + "3452" => 3452, + "3453" => 3453, + "3454" => 3454, + "3455" => 3455, + "3456" => 3456, + "3457" => 3457, + "3458" => 3458, + "3459" => 3459, + "3460" => 3460, + "3461" => 3461, + "3462" => 3462, + "3463" => 3463, + "3464" => 3464, + "3465" => 3465, + "3466" => 3466, + "3467" => 3467, + "3468" => 3468, + "3469" => 3469, + "3470" => 3470, + "3471" => 3471, + "3472" => 3472, + "3473" => 3473, + "3474" => 3474, + "3475" => 3475, + "3476" => 3476, + "3477" => 3477, + "3478" => 3478, + "3479" => 3479, + "3480" => 3480, + "3481" => 3481, + "3482" => 3482, + "3483" => 3483, + "3484" => 3484, + "3485" => 3485, + "3486" => 3486, + "3487" => 3487, + "3488" => 3488, + "3489" => 3489, + "3490" => 3490, + "3491" => 3491, + "3492" => 3492, + "3493" => 3493, + "3494" => 3494, + "3495" => 3495, + "3496" => 3496, + "3497" => 3497, + "3498" => 3498, + "3499" => 3499, + "3500" => 3500, + "3501" => 3501, + "3502" => 3502, + "3503" => 3503, + "3504" => 3504, + "3505" => 3505, + "3506" => 3506, + "3507" => 3507, + "3508" => 3508, + "3509" => 3509, + "3510" => 3510, + "3511" => 3511, + "3512" => 3512, + "3513" => 3513, + "3514" => 3514, + "3515" => 3515, + "3516" => 3516, + "3517" => 3517, + "3518" => 3518, + "3519" => 3519, + "3520" => 3520, + "3521" => 3521, + "3522" => 3522, + "3523" => 3523, + "3524" => 3524, + "3525" => 3525, + "3526" => 3526, + "3527" => 3527, + "3528" => 3528, + "3529" => 3529, + "3530" => 3530, + "3531" => 3531, + "3532" => 3532, + "3533" => 3533, + "3534" => 3534, + "3535" => 3535, + "3536" => 3536, + "3537" => 3537, + "3538" => 3538, + "3539" => 3539, + "3540" => 3540, + "3541" => 3541, + "3542" => 3542, + "3543" => 3543, + "3544" => 3544, + "3545" => 3545, + "3546" => 3546, + "3547" => 3547, + "3548" => 3548, + "3549" => 3549, + "3550" => 3550, + "3551" => 3551, + "3552" => 3552, + "3553" => 3553, + "3554" => 3554, + "3555" => 3555, + "3556" => 3556, + "3557" => 3557, + "3558" => 3558, + "3559" => 3559, + "3560" => 3560, + "3561" => 3561, + "3562" => 3562, + "3563" => 3563, + "3564" => 3564, + "3565" => 3565, + "3566" => 3566, + "3567" => 3567, + "3568" => 3568, + "3569" => 3569, + "3570" => 3570, + "3571" => 3571, + "3572" => 3572, + "3573" => 3573, + "3574" => 3574, + "3575" => 3575, + "3576" => 3576, + "3577" => 3577, + "3578" => 3578, + "3579" => 3579, + "3580" => 3580, + "3581" => 3581, + "3582" => 3582, + "3583" => 3583, + "3584" => 3584, + "3585" => 3585, + "3586" => 3586, + "3587" => 3587, + "3588" => 3588, + "3589" => 3589, + "3590" => 3590, + "3591" => 3591, + "3592" => 3592, + "3593" => 3593, + "3594" => 3594, + "3595" => 3595, + "3596" => 3596, + "3597" => 3597, + "3598" => 3598, + "3599" => 3599, + "3600" => 3600, + "3601" => 3601, + "3602" => 3602, + "3603" => 3603, + "3604" => 3604, + "3605" => 3605, + "3606" => 3606, + "3607" => 3607, + "3608" => 3608, + "3609" => 3609, + "3610" => 3610, + "3611" => 3611, + "3612" => 3612, + "3613" => 3613, + "3614" => 3614, + "3615" => 3615, + "3616" => 3616, + "3617" => 3617, + "3618" => 3618, + "3619" => 3619, + "3620" => 3620, + "3621" => 3621, + "3622" => 3622, + "3623" => 3623, + "3624" => 3624, + "3625" => 3625, + "3626" => 3626, + "3627" => 3627, + "3628" => 3628, + "3629" => 3629, + "3630" => 3630, + "3631" => 3631, + "3632" => 3632, + "3633" => 3633, + "3634" => 3634, + "3635" => 3635, + "3636" => 3636, + "3637" => 3637, + "3638" => 3638, + "3639" => 3639, + "3640" => 3640, + "3641" => 3641, + "3642" => 3642, + "3643" => 3643, + "3644" => 3644, + "3645" => 3645, + "3646" => 3646, + "3647" => 3647, + "3648" => 3648, + "3649" => 3649, + "3650" => 3650, + "3651" => 3651, + "3652" => 3652, + "3653" => 3653, + "3654" => 3654, + "3655" => 3655, + "3656" => 3656, + "3657" => 3657, + "3658" => 3658, + "3659" => 3659, + "3660" => 3660, + "3661" => 3661, + "3662" => 3662, + "3663" => 3663, + "3664" => 3664, + "3665" => 3665, + "3666" => 3666, + "3667" => 3667, + "3668" => 3668, + "3669" => 3669, + "3670" => 3670, + "3671" => 3671, + "3672" => 3672, + "3673" => 3673, + "3674" => 3674, + "3675" => 3675, + "3676" => 3676, + "3677" => 3677, + "3678" => 3678, + "3679" => 3679, + "3680" => 3680, + "3681" => 3681, + "3682" => 3682, + "3683" => 3683, + "3684" => 3684, + "3685" => 3685, + "3686" => 3686, + "3687" => 3687, + "3688" => 3688, + "3689" => 3689, + "3690" => 3690, + "3691" => 3691, + "3692" => 3692, + "3693" => 3693, + "3694" => 3694, + "3695" => 3695, + "3696" => 3696, + "3697" => 3697, + "3698" => 3698, + "3699" => 3699, + "3700" => 3700, + "3701" => 3701, + "3702" => 3702, + "3703" => 3703, + "3704" => 3704, + "3705" => 3705, + "3706" => 3706, + "3707" => 3707, + "3708" => 3708, + "3709" => 3709, + "3710" => 3710, + "3711" => 3711, + "3712" => 3712, + "3713" => 3713, + "3714" => 3714, + "3715" => 3715, + "3716" => 3716, + "3717" => 3717, + "3718" => 3718, + "3719" => 3719, + "3720" => 3720, + "3721" => 3721, + "3722" => 3722, + "3723" => 3723, + "3724" => 3724, + "3725" => 3725, + "3726" => 3726, + "3727" => 3727, + "3728" => 3728, + "3729" => 3729, + "3730" => 3730, + "3731" => 3731, + "3732" => 3732, + "3733" => 3733, + "3734" => 3734, + "3735" => 3735, + "3736" => 3736, + "3737" => 3737, + "3738" => 3738, + "3739" => 3739, + "3740" => 3740, + "3741" => 3741, + "3742" => 3742, + "3743" => 3743, + "3744" => 3744, + "3745" => 3745, + "3746" => 3746, + "3747" => 3747, + "3748" => 3748, + "3749" => 3749, + "3750" => 3750, + "3751" => 3751, + "3752" => 3752, + "3753" => 3753, + "3754" => 3754, + "3755" => 3755, + "3756" => 3756, + "3757" => 3757, + "3758" => 3758, + "3759" => 3759, + "3760" => 3760, + "3761" => 3761, + "3762" => 3762, + "3763" => 3763, + "3764" => 3764, + "3765" => 3765, + "3766" => 3766, + "3767" => 3767, + "3768" => 3768, + "3769" => 3769, + "3770" => 3770, + "3771" => 3771, + "3772" => 3772, + "3773" => 3773, + "3774" => 3774, + "3775" => 3775, + "3776" => 3776, + "3777" => 3777, + "3778" => 3778, + "3779" => 3779, + "3780" => 3780, + "3781" => 3781, + "3782" => 3782, + "3783" => 3783, + "3784" => 3784, + "3785" => 3785, + "3786" => 3786, + "3787" => 3787, + "3788" => 3788, + "3789" => 3789, + "3790" => 3790, + "3791" => 3791, + "3792" => 3792, + "3793" => 3793, + "3794" => 3794, + "3795" => 3795, + "3796" => 3796, + "3797" => 3797, + "3798" => 3798, + "3799" => 3799, + "3800" => 3800, + "3801" => 3801, + "3802" => 3802, + "3803" => 3803, + "3804" => 3804, + "3805" => 3805, + "3806" => 3806, + "3807" => 3807, + "3808" => 3808, + "3809" => 3809, + "3810" => 3810, + "3811" => 3811, + "3812" => 3812, + "3813" => 3813, + "3814" => 3814, + "3815" => 3815, + "3816" => 3816, + "3817" => 3817, + "3818" => 3818, + "3819" => 3819, + "3820" => 3820, + "3821" => 3821, + "3822" => 3822, + "3823" => 3823, + "3824" => 3824, + "3825" => 3825, + "3826" => 3826, + "3827" => 3827, + "3828" => 3828, + "3829" => 3829, + "3830" => 3830, + "3831" => 3831, + "3832" => 3832, + "3833" => 3833, + "3834" => 3834, + "3835" => 3835, + "3836" => 3836, + "3837" => 3837, + "3838" => 3838, + "3839" => 3839, + "3840" => 3840, + "3841" => 3841, + "3842" => 3842, + "3843" => 3843, + "3844" => 3844, + "3845" => 3845, + "3846" => 3846, + "3847" => 3847, + "3848" => 3848, + "3849" => 3849, + "3850" => 3850, + "3851" => 3851, + "3852" => 3852, + "3853" => 3853, + "3854" => 3854, + "3855" => 3855, + "3856" => 3856, + "3857" => 3857, + "3858" => 3858, + "3859" => 3859, + "3860" => 3860, + "3861" => 3861, + "3862" => 3862, + "3863" => 3863, + "3864" => 3864, + "3865" => 3865, + "3866" => 3866, + "3867" => 3867, + "3868" => 3868, + "3869" => 3869, + "3870" => 3870, + "3871" => 3871, + "3872" => 3872, + "3873" => 3873, + "3874" => 3874, + "3875" => 3875, + "3876" => 3876, + "3877" => 3877, + "3878" => 3878, + "3879" => 3879, + "3880" => 3880, + "3881" => 3881, + "3882" => 3882, + "3883" => 3883, + "3884" => 3884, + "3885" => 3885, + "3886" => 3886, + "3887" => 3887, + "3888" => 3888, + "3889" => 3889, + "3890" => 3890, + "3891" => 3891, + "3892" => 3892, + "3893" => 3893, + "3894" => 3894, + "3895" => 3895, + "3896" => 3896, + "3897" => 3897, + "3898" => 3898, + "3899" => 3899, + "3900" => 3900, + "3901" => 3901, + "3902" => 3902, + "3903" => 3903, + "3904" => 3904, + "3905" => 3905, + "3906" => 3906, + "3907" => 3907, + "3908" => 3908, + "3909" => 3909, + "3910" => 3910, + "3911" => 3911, + "3912" => 3912, + "3913" => 3913, + "3914" => 3914, + "3915" => 3915, + "3916" => 3916, + "3917" => 3917, + "3918" => 3918, + "3919" => 3919, + "3920" => 3920, + "3921" => 3921, + "3922" => 3922, + "3923" => 3923, + "3924" => 3924, + "3925" => 3925, + "3926" => 3926, + "3927" => 3927, + "3928" => 3928, + "3929" => 3929, + "3930" => 3930, + "3931" => 3931, + "3932" => 3932, + "3933" => 3933, + "3934" => 3934, + "3935" => 3935, + "3936" => 3936, + "3937" => 3937, + "3938" => 3938, + "3939" => 3939, + "3940" => 3940, + "3941" => 3941, + "3942" => 3942, + "3943" => 3943, + "3944" => 3944, + "3945" => 3945, + "3946" => 3946, + "3947" => 3947, + "3948" => 3948, + "3949" => 3949, + "3950" => 3950, + "3951" => 3951, + "3952" => 3952, + "3953" => 3953, + "3954" => 3954, + "3955" => 3955, + "3956" => 3956, + "3957" => 3957, + "3958" => 3958, + "3959" => 3959, + "3960" => 3960, + "3961" => 3961, + "3962" => 3962, + "3963" => 3963, + "3964" => 3964, + "3965" => 3965, + "3966" => 3966, + "3967" => 3967, + "3968" => 3968, + "3969" => 3969, + "3970" => 3970, + "3971" => 3971, + "3972" => 3972, + "3973" => 3973, + "3974" => 3974, + "3975" => 3975, + "3976" => 3976, + "3977" => 3977, + "3978" => 3978, + "3979" => 3979, + "3980" => 3980, + "3981" => 3981, + "3982" => 3982, + "3983" => 3983, + "3984" => 3984, + "3985" => 3985, + "3986" => 3986, + "3987" => 3987, + "3988" => 3988, + "3989" => 3989, + "3990" => 3990, + "3991" => 3991, + "3992" => 3992, + "3993" => 3993, + "3994" => 3994, + "3995" => 3995, + "3996" => 3996, + "3997" => 3997, + "3998" => 3998, + "3999" => 3999, + "4000" => 4000, + "4001" => 4001, + "4002" => 4002, + "4003" => 4003, + "4004" => 4004, + "4005" => 4005, + "4006" => 4006, + "4007" => 4007, + "4008" => 4008, + "4009" => 4009, + "4010" => 4010, + "4011" => 4011, + "4012" => 4012, + "4013" => 4013, + "4014" => 4014, + "4015" => 4015, + "4016" => 4016, + "4017" => 4017, + "4018" => 4018, + "4019" => 4019, + "4020" => 4020, + "4021" => 4021, + "4022" => 4022, + "4023" => 4023, + "4024" => 4024, + "4025" => 4025, + "4026" => 4026, + "4027" => 4027, + "4028" => 4028, + "4029" => 4029, + "4030" => 4030, + "4031" => 4031, + "4032" => 4032, + "4033" => 4033, + "4034" => 4034, + "4035" => 4035, + "4036" => 4036, + "4037" => 4037, + "4038" => 4038, + "4039" => 4039, + "4040" => 4040, + "4041" => 4041, + "4042" => 4042, + "4043" => 4043, + "4044" => 4044, + "4045" => 4045, + "4046" => 4046, + "4047" => 4047, + "4048" => 4048, + "4049" => 4049, + "4050" => 4050, + "4051" => 4051, + "4052" => 4052, + "4053" => 4053, + "4054" => 4054, + "4055" => 4055, + "4056" => 4056, + "4057" => 4057, + "4058" => 4058, + "4059" => 4059, + "4060" => 4060, + "4061" => 4061, + "4062" => 4062, + "4063" => 4063, + "4064" => 4064, + "4065" => 4065, + "4066" => 4066, + "4067" => 4067, + "4068" => 4068, + "4069" => 4069, + "4070" => 4070, + "4071" => 4071, + "4072" => 4072, + "4073" => 4073, + "4074" => 4074, + "4075" => 4075, + "4076" => 4076, + "4077" => 4077, + "4078" => 4078, + "4079" => 4079, + "4080" => 4080, + "4081" => 4081, + "4082" => 4082, + "4083" => 4083, + "4084" => 4084, + "4085" => 4085, + "4086" => 4086, + "4087" => 4087, + "4088" => 4088, + "4089" => 4089, + "4090" => 4090, + "4091" => 4091, + "4092" => 4092, + "4093" => 4093, + "4094" => 4094, + "4095" => 4095, + "4096" => 4096, + "4097" => 4097, + "4098" => 4098, + "4099" => 4099, + "4100" => 4100, + "4101" => 4101, + "4102" => 4102, + "4103" => 4103, + "4104" => 4104, + "4105" => 4105, + "4106" => 4106, + "4107" => 4107, + "4108" => 4108, + "4109" => 4109, + "4110" => 4110, + "4111" => 4111, + "4112" => 4112, + "4113" => 4113, + "4114" => 4114, + "4115" => 4115, + "4116" => 4116, + "4117" => 4117, + "4118" => 4118, + "4119" => 4119, + "4120" => 4120, + "4121" => 4121, + "4122" => 4122, + "4123" => 4123, + "4124" => 4124, + "4125" => 4125, + "4126" => 4126, + "4127" => 4127, + "4128" => 4128, + "4129" => 4129, + "4130" => 4130, + "4131" => 4131, + "4132" => 4132, + "4133" => 4133, + "4134" => 4134, + "4135" => 4135, + "4136" => 4136, + "4137" => 4137, + "4138" => 4138, + "4139" => 4139, + "4140" => 4140, + "4141" => 4141, + "4142" => 4142, + "4143" => 4143, + "4144" => 4144, + "4145" => 4145, + "4146" => 4146, + "4147" => 4147, + "4148" => 4148, + "4149" => 4149, + "4150" => 4150, + "4151" => 4151, + "4152" => 4152, + "4153" => 4153, + "4154" => 4154, + "4155" => 4155, + "4156" => 4156, + "4157" => 4157, + "4158" => 4158, + "4159" => 4159, + "4160" => 4160, + "4161" => 4161, + "4162" => 4162, + "4163" => 4163, + "4164" => 4164, + "4165" => 4165, + "4166" => 4166, + "4167" => 4167, + "4168" => 4168, + "4169" => 4169, + "4170" => 4170, + "4171" => 4171, + "4172" => 4172, + "4173" => 4173, + "4174" => 4174, + "4175" => 4175, + "4176" => 4176, + "4177" => 4177, + "4178" => 4178, + "4179" => 4179, + "4180" => 4180, + "4181" => 4181, + "4182" => 4182, + "4183" => 4183, + "4184" => 4184, + "4185" => 4185, + "4186" => 4186, + "4187" => 4187, + "4188" => 4188, + "4189" => 4189, + "4190" => 4190, + "4191" => 4191, + "4192" => 4192, + "4193" => 4193, + "4194" => 4194, + "4195" => 4195, + "4196" => 4196, + "4197" => 4197, + "4198" => 4198, + "4199" => 4199, + "4200" => 4200, + "4201" => 4201, + "4202" => 4202, + "4203" => 4203, + "4204" => 4204, + "4205" => 4205, + "4206" => 4206, + "4207" => 4207, + "4208" => 4208, + "4209" => 4209, + "4210" => 4210, + "4211" => 4211, + "4212" => 4212, + "4213" => 4213, + "4214" => 4214, + "4215" => 4215, + "4216" => 4216, + "4217" => 4217, + "4218" => 4218, + "4219" => 4219, + "4220" => 4220, + "4221" => 4221, + "4222" => 4222, + "4223" => 4223, + "4224" => 4224, + "4225" => 4225, + "4226" => 4226, + "4227" => 4227, + "4228" => 4228, + "4229" => 4229, + "4230" => 4230, + "4231" => 4231, + "4232" => 4232, + "4233" => 4233, + "4234" => 4234, + "4235" => 4235, + "4236" => 4236, + "4237" => 4237, + "4238" => 4238, + "4239" => 4239, + "4240" => 4240, + "4241" => 4241, + "4242" => 4242, + "4243" => 4243, + "4244" => 4244, + "4245" => 4245, + "4246" => 4246, + "4247" => 4247, + "4248" => 4248, + "4249" => 4249, + "4250" => 4250, + "4251" => 4251, + "4252" => 4252, + "4253" => 4253, + "4254" => 4254, + "4255" => 4255, + "4256" => 4256, + "4257" => 4257, + "4258" => 4258, + "4259" => 4259, + "4260" => 4260, + "4261" => 4261, + "4262" => 4262, + "4263" => 4263, + "4264" => 4264, + "4265" => 4265, + "4266" => 4266, + "4267" => 4267, + "4268" => 4268, + "4269" => 4269, + "4270" => 4270, + "4271" => 4271, + "4272" => 4272, + "4273" => 4273, + "4274" => 4274, + "4275" => 4275, + "4276" => 4276, + "4277" => 4277, + "4278" => 4278, + "4279" => 4279, + "4280" => 4280, + "4281" => 4281, + "4282" => 4282, + "4283" => 4283, + "4284" => 4284, + "4285" => 4285, + "4286" => 4286, + "4287" => 4287, + "4288" => 4288, + "4289" => 4289, + "4290" => 4290, + "4291" => 4291, + "4292" => 4292, + "4293" => 4293, + "4294" => 4294, + "4295" => 4295, + "4296" => 4296, + "4297" => 4297, + "4298" => 4298, + "4299" => 4299, + "4300" => 4300, + "4301" => 4301, + "4302" => 4302, + "4303" => 4303, + "4304" => 4304, + "4305" => 4305, + "4306" => 4306, + "4307" => 4307, + "4308" => 4308, + "4309" => 4309, + "4310" => 4310, + "4311" => 4311, + "4312" => 4312, + "4313" => 4313, + "4314" => 4314, + "4315" => 4315, + "4316" => 4316, + "4317" => 4317, + "4318" => 4318, + "4319" => 4319, + "4320" => 4320, + "4321" => 4321, + "4322" => 4322, + "4323" => 4323, + "4324" => 4324, + "4325" => 4325, + "4326" => 4326, + "4327" => 4327, + "4328" => 4328, + "4329" => 4329, + "4330" => 4330, + "4331" => 4331, + "4332" => 4332, + "4333" => 4333, + "4334" => 4334, + "4335" => 4335, + "4336" => 4336, + "4337" => 4337, + "4338" => 4338, + "4339" => 4339, + "4340" => 4340, + "4341" => 4341, + "4342" => 4342, + "4343" => 4343, + "4344" => 4344, + "4345" => 4345, + "4346" => 4346, + "4347" => 4347, + "4348" => 4348, + "4349" => 4349, + "4350" => 4350, + "4351" => 4351, + "4352" => 4352, + "4353" => 4353, + "4354" => 4354, + "4355" => 4355, + "4356" => 4356, + "4357" => 4357, + "4358" => 4358, + "4359" => 4359, + "4360" => 4360, + "4361" => 4361, + "4362" => 4362, + "4363" => 4363, + "4364" => 4364, + "4365" => 4365, + "4366" => 4366, + "4367" => 4367, + "4368" => 4368, + "4369" => 4369, + "4370" => 4370, + "4371" => 4371, + "4372" => 4372, + "4373" => 4373, + "4374" => 4374, + "4375" => 4375, + "4376" => 4376, + "4377" => 4377, + "4378" => 4378, + "4379" => 4379, + "4380" => 4380, + "4381" => 4381, + "4382" => 4382, + "4383" => 4383, + "4384" => 4384, + "4385" => 4385, + "4386" => 4386, + "4387" => 4387, + "4388" => 4388, + "4389" => 4389, + "4390" => 4390, + "4391" => 4391, + "4392" => 4392, + "4393" => 4393, + "4394" => 4394, + "4395" => 4395, + "4396" => 4396, + "4397" => 4397, + "4398" => 4398, + "4399" => 4399, + "4400" => 4400, + "4401" => 4401, + "4402" => 4402, + "4403" => 4403, + "4404" => 4404, + "4405" => 4405, + "4406" => 4406, + "4407" => 4407, + "4408" => 4408, + "4409" => 4409, + "4410" => 4410, + "4411" => 4411, + "4412" => 4412, + "4413" => 4413, + "4414" => 4414, + "4415" => 4415, + "4416" => 4416, + "4417" => 4417, + "4418" => 4418, + "4419" => 4419, + "4420" => 4420, + "4421" => 4421, + "4422" => 4422, + "4423" => 4423, + "4424" => 4424, + "4425" => 4425, + "4426" => 4426, + "4427" => 4427, + "4428" => 4428, + "4429" => 4429, + "4430" => 4430, + "4431" => 4431, + "4432" => 4432, + "4433" => 4433, + "4434" => 4434, + "4435" => 4435, + "4436" => 4436, + "4437" => 4437, + "4438" => 4438, + "4439" => 4439, + "4440" => 4440, + "4441" => 4441, + "4442" => 4442, + "4443" => 4443, + "4444" => 4444, + "4445" => 4445, + "4446" => 4446, + "4447" => 4447, + "4448" => 4448, + "4449" => 4449, + "4450" => 4450, + "4451" => 4451, + "4452" => 4452, + "4453" => 4453, + "4454" => 4454, + "4455" => 4455, + "4456" => 4456, + "4457" => 4457, + "4458" => 4458, + "4459" => 4459, + "4460" => 4460, + "4461" => 4461, + "4462" => 4462, + "4463" => 4463, + "4464" => 4464, + "4465" => 4465, + "4466" => 4466, + "4467" => 4467, + "4468" => 4468, + "4469" => 4469, + "4470" => 4470, + "4471" => 4471, + "4472" => 4472, + "4473" => 4473, + "4474" => 4474, + "4475" => 4475, + "4476" => 4476, + "4477" => 4477, + "4478" => 4478, + "4479" => 4479, + "4480" => 4480, + "4481" => 4481, + "4482" => 4482, + "4483" => 4483, + "4484" => 4484, + "4485" => 4485, + "4486" => 4486, + "4487" => 4487, + "4488" => 4488, + "4489" => 4489, + "4490" => 4490, + "4491" => 4491, + "4492" => 4492, + "4493" => 4493, + "4494" => 4494, + "4495" => 4495, + "4496" => 4496, + "4497" => 4497, + "4498" => 4498, + "4499" => 4499, + "4500" => 4500, + "4501" => 4501, + "4502" => 4502, + "4503" => 4503, + "4504" => 4504, + "4505" => 4505, + "4506" => 4506, + "4507" => 4507, + "4508" => 4508, + "4509" => 4509, + "4510" => 4510, + "4511" => 4511, + "4512" => 4512, + "4513" => 4513, + "4514" => 4514, + "4515" => 4515, + "4516" => 4516, + "4517" => 4517, + "4518" => 4518, + "4519" => 4519, + "4520" => 4520, + "4521" => 4521, + "4522" => 4522, + "4523" => 4523, + "4524" => 4524, + "4525" => 4525, + "4526" => 4526, + "4527" => 4527, + "4528" => 4528, + "4529" => 4529, + "4530" => 4530, + "4531" => 4531, + "4532" => 4532, + "4533" => 4533, + "4534" => 4534, + "4535" => 4535, + "4536" => 4536, + "4537" => 4537, + "4538" => 4538, + "4539" => 4539, + "4540" => 4540, + "4541" => 4541, + "4542" => 4542, + "4543" => 4543, + "4544" => 4544, + "4545" => 4545, + "4546" => 4546, + "4547" => 4547, + "4548" => 4548, + "4549" => 4549, + "4550" => 4550, + "4551" => 4551, + "4552" => 4552, + "4553" => 4553, + "4554" => 4554, + "4555" => 4555, + "4556" => 4556, + "4557" => 4557, + "4558" => 4558, + "4559" => 4559, + "4560" => 4560, + "4561" => 4561, + "4562" => 4562, + "4563" => 4563, + "4564" => 4564, + "4565" => 4565, + "4566" => 4566, + "4567" => 4567, + "4568" => 4568, + "4569" => 4569, + "4570" => 4570, + "4571" => 4571, + "4572" => 4572, + "4573" => 4573, + "4574" => 4574, + "4575" => 4575, + "4576" => 4576, + "4577" => 4577, + "4578" => 4578, + "4579" => 4579, + "4580" => 4580, + "4581" => 4581, + "4582" => 4582, + "4583" => 4583, + "4584" => 4584, + "4585" => 4585, + "4586" => 4586, + "4587" => 4587, + "4588" => 4588, + "4589" => 4589, + "4590" => 4590, + "4591" => 4591, + "4592" => 4592, + "4593" => 4593, + "4594" => 4594, + "4595" => 4595, + "4596" => 4596, + "4597" => 4597, + "4598" => 4598, + "4599" => 4599, + "4600" => 4600, + "4601" => 4601, + "4602" => 4602, + "4603" => 4603, + "4604" => 4604, + "4605" => 4605, + "4606" => 4606, + "4607" => 4607, + "4608" => 4608, + "4609" => 4609, + "4610" => 4610, + "4611" => 4611, + "4612" => 4612, + "4613" => 4613, + "4614" => 4614, + "4615" => 4615, + "4616" => 4616, + "4617" => 4617, + "4618" => 4618, + "4619" => 4619, + "4620" => 4620, + "4621" => 4621, + "4622" => 4622, + "4623" => 4623, + "4624" => 4624, + "4625" => 4625, + "4626" => 4626, + "4627" => 4627, + "4628" => 4628, + "4629" => 4629, + "4630" => 4630, + "4631" => 4631, + "4632" => 4632, + "4633" => 4633, + "4634" => 4634, + "4635" => 4635, + "4636" => 4636, + "4637" => 4637, + "4638" => 4638, + "4639" => 4639, + "4640" => 4640, + "4641" => 4641, + "4642" => 4642, + "4643" => 4643, + "4644" => 4644, + "4645" => 4645, + "4646" => 4646, + "4647" => 4647, + "4648" => 4648, + "4649" => 4649, + "4650" => 4650, + "4651" => 4651, + "4652" => 4652, + "4653" => 4653, + "4654" => 4654, + "4655" => 4655, + "4656" => 4656, + "4657" => 4657, + "4658" => 4658, + "4659" => 4659, + "4660" => 4660, + "4661" => 4661, + "4662" => 4662, + "4663" => 4663, + "4664" => 4664, + "4665" => 4665, + "4666" => 4666, + "4667" => 4667, + "4668" => 4668, + "4669" => 4669, + "4670" => 4670, + "4671" => 4671, + "4672" => 4672, + "4673" => 4673, + "4674" => 4674, + "4675" => 4675, + "4676" => 4676, + "4677" => 4677, + "4678" => 4678, + "4679" => 4679, + "4680" => 4680, + "4681" => 4681, + "4682" => 4682, + "4683" => 4683, + "4684" => 4684, + "4685" => 4685, + "4686" => 4686, + "4687" => 4687, + "4688" => 4688, + "4689" => 4689, + "4690" => 4690, + "4691" => 4691, + "4692" => 4692, + "4693" => 4693, + "4694" => 4694, + "4695" => 4695, + "4696" => 4696, + "4697" => 4697, + "4698" => 4698, + "4699" => 4699, + "4700" => 4700, + "4701" => 4701, + "4702" => 4702, + "4703" => 4703, + "4704" => 4704, + "4705" => 4705, + "4706" => 4706, + "4707" => 4707, + "4708" => 4708, + "4709" => 4709, + "4710" => 4710, + "4711" => 4711, + "4712" => 4712, + "4713" => 4713, + "4714" => 4714, + "4715" => 4715, + "4716" => 4716, + "4717" => 4717, + "4718" => 4718, + "4719" => 4719, + "4720" => 4720, + "4721" => 4721, + "4722" => 4722, + "4723" => 4723, + "4724" => 4724, + "4725" => 4725, + "4726" => 4726, + "4727" => 4727, + "4728" => 4728, + "4729" => 4729, + "4730" => 4730, + "4731" => 4731, + "4732" => 4732, + "4733" => 4733, + "4734" => 4734, + "4735" => 4735, + "4736" => 4736, + "4737" => 4737, + "4738" => 4738, + "4739" => 4739, + "4740" => 4740, + "4741" => 4741, + "4742" => 4742, + "4743" => 4743, + "4744" => 4744, + "4745" => 4745, + "4746" => 4746, + "4747" => 4747, + "4748" => 4748, + "4749" => 4749, + "4750" => 4750, + "4751" => 4751, + "4752" => 4752, + "4753" => 4753, + "4754" => 4754, + "4755" => 4755, + "4756" => 4756, + "4757" => 4757, + "4758" => 4758, + "4759" => 4759, + "4760" => 4760, + "4761" => 4761, + "4762" => 4762, + "4763" => 4763, + "4764" => 4764, + "4765" => 4765, + "4766" => 4766, + "4767" => 4767, + "4768" => 4768, + "4769" => 4769, + "4770" => 4770, + "4771" => 4771, + "4772" => 4772, + "4773" => 4773, + "4774" => 4774, + "4775" => 4775, + "4776" => 4776, + "4777" => 4777, + "4778" => 4778, + "4779" => 4779, + "4780" => 4780, + "4781" => 4781, + "4782" => 4782, + "4783" => 4783, + "4784" => 4784, + "4785" => 4785, + "4786" => 4786, + "4787" => 4787, + "4788" => 4788, + "4789" => 4789, + "4790" => 4790, + "4791" => 4791, + "4792" => 4792, + "4793" => 4793, + "4794" => 4794, + "4795" => 4795, + "4796" => 4796, + "4797" => 4797, + "4798" => 4798, + "4799" => 4799, + "4800" => 4800, + "4801" => 4801, + "4802" => 4802, + "4803" => 4803, + "4804" => 4804, + "4805" => 4805, + "4806" => 4806, + "4807" => 4807, + "4808" => 4808, + "4809" => 4809, + "4810" => 4810, + "4811" => 4811, + "4812" => 4812, + "4813" => 4813, + "4814" => 4814, + "4815" => 4815, + "4816" => 4816, + "4817" => 4817, + "4818" => 4818, + "4819" => 4819, + "4820" => 4820, + "4821" => 4821, + "4822" => 4822, + "4823" => 4823, + "4824" => 4824, + "4825" => 4825, + "4826" => 4826, + "4827" => 4827, + "4828" => 4828, + "4829" => 4829, + "4830" => 4830, + "4831" => 4831, + "4832" => 4832, + "4833" => 4833, + "4834" => 4834, + "4835" => 4835, + "4836" => 4836, + "4837" => 4837, + "4838" => 4838, + "4839" => 4839, + "4840" => 4840, + "4841" => 4841, + "4842" => 4842, + "4843" => 4843, + "4844" => 4844, + "4845" => 4845, + "4846" => 4846, + "4847" => 4847, + "4848" => 4848, + "4849" => 4849, + "4850" => 4850, + "4851" => 4851, + "4852" => 4852, + "4853" => 4853, + "4854" => 4854, + "4855" => 4855, + "4856" => 4856, + "4857" => 4857, + "4858" => 4858, + "4859" => 4859, + "4860" => 4860, + "4861" => 4861, + "4862" => 4862, + "4863" => 4863, + "4864" => 4864, + "4865" => 4865, + "4866" => 4866, + "4867" => 4867, + "4868" => 4868, + "4869" => 4869, + "4870" => 4870, + "4871" => 4871, + "4872" => 4872, + "4873" => 4873, + "4874" => 4874, + "4875" => 4875, + "4876" => 4876, + "4877" => 4877, + "4878" => 4878, + "4879" => 4879, + "4880" => 4880, + "4881" => 4881, + "4882" => 4882, + "4883" => 4883, + "4884" => 4884, + "4885" => 4885, + "4886" => 4886, + "4887" => 4887, + "4888" => 4888, + "4889" => 4889, + "4890" => 4890, + "4891" => 4891, + "4892" => 4892, + "4893" => 4893, + "4894" => 4894, + "4895" => 4895, + "4896" => 4896, + "4897" => 4897, + "4898" => 4898, + "4899" => 4899, + "4900" => 4900, + "4901" => 4901, + "4902" => 4902, + "4903" => 4903, + "4904" => 4904, + "4905" => 4905, + "4906" => 4906, + "4907" => 4907, + "4908" => 4908, + "4909" => 4909, + "4910" => 4910, + "4911" => 4911, + "4912" => 4912, + "4913" => 4913, + "4914" => 4914, + "4915" => 4915, + "4916" => 4916, + "4917" => 4917, + "4918" => 4918, + "4919" => 4919, + "4920" => 4920, + "4921" => 4921, + "4922" => 4922, + "4923" => 4923, + "4924" => 4924, + "4925" => 4925, + "4926" => 4926, + "4927" => 4927, + "4928" => 4928, + "4929" => 4929, + "4930" => 4930, + "4931" => 4931, + "4932" => 4932, + "4933" => 4933, + "4934" => 4934, + "4935" => 4935, + "4936" => 4936, + "4937" => 4937, + "4938" => 4938, + "4939" => 4939, + "4940" => 4940, + "4941" => 4941, + "4942" => 4942, + "4943" => 4943, + "4944" => 4944, + "4945" => 4945, + "4946" => 4946, + "4947" => 4947, + "4948" => 4948, + "4949" => 4949, + "4950" => 4950, + "4951" => 4951, + "4952" => 4952, + "4953" => 4953, + "4954" => 4954, + "4955" => 4955, + "4956" => 4956, + "4957" => 4957, + "4958" => 4958, + "4959" => 4959, + "4960" => 4960, + "4961" => 4961, + "4962" => 4962, + "4963" => 4963, + "4964" => 4964, + "4965" => 4965, + "4966" => 4966, + "4967" => 4967, + "4968" => 4968, + "4969" => 4969, + "4970" => 4970, + "4971" => 4971, + "4972" => 4972, + "4973" => 4973, + "4974" => 4974, + "4975" => 4975, + "4976" => 4976, + "4977" => 4977, + "4978" => 4978, + "4979" => 4979, + "4980" => 4980, + "4981" => 4981, + "4982" => 4982, + "4983" => 4983, + "4984" => 4984, + "4985" => 4985, + "4986" => 4986, + "4987" => 4987, + "4988" => 4988, + "4989" => 4989, + "4990" => 4990, + "4991" => 4991, + "4992" => 4992, + "4993" => 4993, + "4994" => 4994, + "4995" => 4995, + "4996" => 4996, + "4997" => 4997, + "4998" => 4998, + "4999" => 4999, + "5000" => 5000, + "5001" => 5001, + "5002" => 5002, + "5003" => 5003, + "5004" => 5004, + "5005" => 5005, + "5006" => 5006, + "5007" => 5007, + "5008" => 5008, + "5009" => 5009, + "5010" => 5010, + "5011" => 5011, + "5012" => 5012, + "5013" => 5013, + "5014" => 5014, + "5015" => 5015, + "5016" => 5016, + "5017" => 5017, + "5018" => 5018, + "5019" => 5019, + "5020" => 5020, + "5021" => 5021, + "5022" => 5022, + "5023" => 5023, + "5024" => 5024, + "5025" => 5025, + "5026" => 5026, + "5027" => 5027, + "5028" => 5028, + "5029" => 5029, + "5030" => 5030, + "5031" => 5031, + "5032" => 5032, + "5033" => 5033, + "5034" => 5034, + "5035" => 5035, + "5036" => 5036, + "5037" => 5037, + "5038" => 5038, + "5039" => 5039, + "5040" => 5040, + "5041" => 5041, + "5042" => 5042, + "5043" => 5043, + "5044" => 5044, + "5045" => 5045, + "5046" => 5046, + "5047" => 5047, + "5048" => 5048, + "5049" => 5049, + "5050" => 5050, + "5051" => 5051, + "5052" => 5052, + "5053" => 5053, + "5054" => 5054, + "5055" => 5055, + "5056" => 5056, + "5057" => 5057, + "5058" => 5058, + "5059" => 5059, + "5060" => 5060, + "5061" => 5061, + "5062" => 5062, + "5063" => 5063, + "5064" => 5064, + "5065" => 5065, + "5066" => 5066, + "5067" => 5067, + "5068" => 5068, + "5069" => 5069, + "5070" => 5070, + "5071" => 5071, + "5072" => 5072, + "5073" => 5073, + "5074" => 5074, + "5075" => 5075, + "5076" => 5076, + "5077" => 5077, + "5078" => 5078, + "5079" => 5079, + "5080" => 5080, + "5081" => 5081, + "5082" => 5082, + "5083" => 5083, + "5084" => 5084, + "5085" => 5085, + "5086" => 5086, + "5087" => 5087, + "5088" => 5088, + "5089" => 5089, + "5090" => 5090, + "5091" => 5091, + "5092" => 5092, + "5093" => 5093, + "5094" => 5094, + "5095" => 5095, + "5096" => 5096, + "5097" => 5097, + "5098" => 5098, + "5099" => 5099, + "5100" => 5100, + "5101" => 5101, + "5102" => 5102, + "5103" => 5103, + "5104" => 5104, + "5105" => 5105, + "5106" => 5106, + "5107" => 5107, + "5108" => 5108, + "5109" => 5109, + "5110" => 5110, + "5111" => 5111, + "5112" => 5112, + "5113" => 5113, + "5114" => 5114, + "5115" => 5115, + "5116" => 5116, + "5117" => 5117, + "5118" => 5118, + "5119" => 5119, + "5120" => 5120, + "5121" => 5121, + "5122" => 5122, + "5123" => 5123, + "5124" => 5124, + "5125" => 5125, + "5126" => 5126, + "5127" => 5127, + "5128" => 5128, + "5129" => 5129, + "5130" => 5130, + "5131" => 5131, + "5132" => 5132, + "5133" => 5133, + "5134" => 5134, + "5135" => 5135, + "5136" => 5136, + "5137" => 5137, + "5138" => 5138, + "5139" => 5139, + "5140" => 5140, + "5141" => 5141, + "5142" => 5142, + "5143" => 5143, + "5144" => 5144, + "5145" => 5145, + "5146" => 5146, + "5147" => 5147, + "5148" => 5148, + "5149" => 5149, + "5150" => 5150, + "5151" => 5151, + "5152" => 5152, + "5153" => 5153, + "5154" => 5154, + "5155" => 5155, + "5156" => 5156, + "5157" => 5157, + "5158" => 5158, + "5159" => 5159, + "5160" => 5160, + "5161" => 5161, + "5162" => 5162, + "5163" => 5163, + "5164" => 5164, + "5165" => 5165, + "5166" => 5166, + "5167" => 5167, + "5168" => 5168, + "5169" => 5169, + "5170" => 5170, + "5171" => 5171, + "5172" => 5172, + "5173" => 5173, + "5174" => 5174, + "5175" => 5175, + "5176" => 5176, + "5177" => 5177, + "5178" => 5178, + "5179" => 5179, + "5180" => 5180, + "5181" => 5181, + "5182" => 5182, + "5183" => 5183, + "5184" => 5184, + "5185" => 5185, + "5186" => 5186, + "5187" => 5187, + "5188" => 5188, + "5189" => 5189, + "5190" => 5190, + "5191" => 5191, + "5192" => 5192, + "5193" => 5193, + "5194" => 5194, + "5195" => 5195, + "5196" => 5196, + "5197" => 5197, + "5198" => 5198, + _ => 5199, + } +} diff --git a/tests/ui/issues/issue-73112.rs b/tests/ui/issues/issue-73112.rs new file mode 100644 index 000000000..cc7be9c95 --- /dev/null +++ b/tests/ui/issues/issue-73112.rs @@ -0,0 +1,13 @@ +// aux-build:issue-73112.rs + +extern crate issue_73112; + +fn main() { + use issue_73112::PageTable; + + #[repr(C, packed)] + struct SomeStruct { + //~^ ERROR packed type cannot transitively contain a `#[repr(align)]` type [E0588] + page_table: PageTable, + } +} diff --git a/tests/ui/issues/issue-73112.stderr b/tests/ui/issues/issue-73112.stderr new file mode 100644 index 000000000..4b8b97966 --- /dev/null +++ b/tests/ui/issues/issue-73112.stderr @@ -0,0 +1,15 @@ +error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type + --> $DIR/issue-73112.rs:9:5 + | +LL | struct SomeStruct { + | ^^^^^^^^^^^^^^^^^ + | +note: `PageTable` has a `#[repr(align)]` attribute + --> $DIR/auxiliary/issue-73112.rs:8:1 + | +LL | pub struct PageTable { + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0588`. diff --git a/tests/ui/issues/issue-73229.rs b/tests/ui/issues/issue-73229.rs new file mode 100644 index 000000000..35346199a --- /dev/null +++ b/tests/ui/issues/issue-73229.rs @@ -0,0 +1,33 @@ +// check-pass + +fn any<T>() -> T { + loop {} +} + +trait Foo { + type V; +} + +trait Callback<T: Foo>: Fn(&T, &T::V) {} +impl<T: Foo, F: Fn(&T, &T::V)> Callback<T> for F {} + +struct Bar<T: Foo> { + callback: Box<dyn Callback<T>>, +} + +impl<T: Foo> Bar<T> { + fn event(&self) { + (self.callback)(any(), any()); + } +} + +struct A; +struct B; +impl Foo for A { + type V = B; +} + +fn main() { + let foo = Bar::<A> { callback: Box::new(|_: &A, _: &B| ()) }; + foo.event(); +} diff --git a/tests/ui/issues/issue-7344.rs b/tests/ui/issues/issue-7344.rs new file mode 100644 index 000000000..f1727d0c1 --- /dev/null +++ b/tests/ui/issues/issue-7344.rs @@ -0,0 +1,22 @@ +// run-pass +#![allow(unused_must_use)] +// pretty-expanded FIXME #23616 + +#![allow(unreachable_code)] + +fn foo() -> bool { false } + +fn bar() { + return; + !foo(); +} + +fn baz() { + return; + if "" == "" {} +} + +pub fn main() { + bar(); + baz(); +} diff --git a/tests/ui/issues/issue-7364.rs b/tests/ui/issues/issue-7364.rs new file mode 100644 index 000000000..79642bd41 --- /dev/null +++ b/tests/ui/issues/issue-7364.rs @@ -0,0 +1,7 @@ +use std::cell::RefCell; + +// Regression test for issue 7364 +static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); +//~^ ERROR `RefCell<isize>` cannot be shared between threads safely [E0277] + +fn main() { } diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/issues/issue-7364.stderr new file mode 100644 index 000000000..5dc8c2b60 --- /dev/null +++ b/tests/ui/issues/issue-7364.stderr @@ -0,0 +1,14 @@ +error[E0277]: `RefCell<isize>` cannot be shared between threads safely + --> $DIR/issue-7364.rs:4:15 + | +LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); + | ^^^^^^^^^^^^^^^^^^^ `RefCell<isize>` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `RefCell<isize>` + = note: required for `Unique<RefCell<isize>>` to implement `Sync` + = note: required because it appears within the type `Box<RefCell<isize>>` + = note: shared static variables must have a type that implements `Sync` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-74082.rs b/tests/ui/issues/issue-74082.rs new file mode 100644 index 000000000..e3e400c79 --- /dev/null +++ b/tests/ui/issues/issue-74082.rs @@ -0,0 +1,9 @@ +#![allow(dead_code)] + +#[repr(i128)] //~ ERROR: attribute should be applied to an enum +struct Foo; + +#[repr(u128)] //~ ERROR: attribute should be applied to an enum +struct Bar; + +fn main() {} diff --git a/tests/ui/issues/issue-74082.stderr b/tests/ui/issues/issue-74082.stderr new file mode 100644 index 000000000..12f5a3b27 --- /dev/null +++ b/tests/ui/issues/issue-74082.stderr @@ -0,0 +1,19 @@ +error[E0517]: attribute should be applied to an enum + --> $DIR/issue-74082.rs:3:8 + | +LL | #[repr(i128)] + | ^^^^ +LL | struct Foo; + | ----------- not an enum + +error[E0517]: attribute should be applied to an enum + --> $DIR/issue-74082.rs:6:8 + | +LL | #[repr(u128)] + | ^^^^ +LL | struct Bar; + | ----------- not an enum + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0517`. diff --git a/tests/ui/issues/issue-74236/auxiliary/dep.rs b/tests/ui/issues/issue-74236/auxiliary/dep.rs new file mode 100644 index 000000000..45f2601d3 --- /dev/null +++ b/tests/ui/issues/issue-74236/auxiliary/dep.rs @@ -0,0 +1,8 @@ +// edition:2018 + +mod private { pub struct Pub; } + +// Reexport built-in attribute without a DefId (requires Rust 2018). +pub use cfg_attr as attr; +// This export needs to be after the built-in attribute to trigger the bug. +pub use private::Pub as Renamed; diff --git a/tests/ui/issues/issue-74236/main.rs b/tests/ui/issues/issue-74236/main.rs new file mode 100644 index 000000000..daa7cfcf9 --- /dev/null +++ b/tests/ui/issues/issue-74236/main.rs @@ -0,0 +1,9 @@ +// edition:2018 +// aux-build:dep.rs +// compile-flags:--extern dep + +fn main() { + // Trigger an error that will print the path of dep::private::Pub (as "dep::Renamed"). + let () = dep::Renamed; + //~^ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-74236/main.stderr b/tests/ui/issues/issue-74236/main.stderr new file mode 100644 index 000000000..55e94ae72 --- /dev/null +++ b/tests/ui/issues/issue-74236/main.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/main.rs:7:9 + | +LL | let () = dep::Renamed; + | ^^ ------------ this expression has type `Renamed` + | | + | expected struct `Renamed`, found `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-74564-if-expr-stack-overflow.rs b/tests/ui/issues/issue-74564-if-expr-stack-overflow.rs new file mode 100644 index 000000000..36e993260 --- /dev/null +++ b/tests/ui/issues/issue-74564-if-expr-stack-overflow.rs @@ -0,0 +1,10419 @@ +// build-pass +// ignore-tidy-filelength +#![crate_type = "rlib"] + +fn banana(v: &str) -> u32 { + if v == "1" { + 1 + } else if v == "2" { + 2 + } else if v == "3" { + 3 + } else if v == "4" { + 4 + } else if v == "5" { + 5 + } else if v == "6" { + 6 + } else if v == "7" { + 7 + } else if v == "8" { + 8 + } else if v == "9" { + 9 + } else if v == "10" { + 10 + } else if v == "11" { + 11 + } else if v == "12" { + 12 + } else if v == "13" { + 13 + } else if v == "14" { + 14 + } else if v == "15" { + 15 + } else if v == "16" { + 16 + } else if v == "17" { + 17 + } else if v == "18" { + 18 + } else if v == "19" { + 19 + } else if v == "20" { + 20 + } else if v == "21" { + 21 + } else if v == "22" { + 22 + } else if v == "23" { + 23 + } else if v == "24" { + 24 + } else if v == "25" { + 25 + } else if v == "26" { + 26 + } else if v == "27" { + 27 + } else if v == "28" { + 28 + } else if v == "29" { + 29 + } else if v == "30" { + 30 + } else if v == "31" { + 31 + } else if v == "32" { + 32 + } else if v == "33" { + 33 + } else if v == "34" { + 34 + } else if v == "35" { + 35 + } else if v == "36" { + 36 + } else if v == "37" { + 37 + } else if v == "38" { + 38 + } else if v == "39" { + 39 + } else if v == "40" { + 40 + } else if v == "41" { + 41 + } else if v == "42" { + 42 + } else if v == "43" { + 43 + } else if v == "44" { + 44 + } else if v == "45" { + 45 + } else if v == "46" { + 46 + } else if v == "47" { + 47 + } else if v == "48" { + 48 + } else if v == "49" { + 49 + } else if v == "50" { + 50 + } else if v == "51" { + 51 + } else if v == "52" { + 52 + } else if v == "53" { + 53 + } else if v == "54" { + 54 + } else if v == "55" { + 55 + } else if v == "56" { + 56 + } else if v == "57" { + 57 + } else if v == "58" { + 58 + } else if v == "59" { + 59 + } else if v == "60" { + 60 + } else if v == "61" { + 61 + } else if v == "62" { + 62 + } else if v == "63" { + 63 + } else if v == "64" { + 64 + } else if v == "65" { + 65 + } else if v == "66" { + 66 + } else if v == "67" { + 67 + } else if v == "68" { + 68 + } else if v == "69" { + 69 + } else if v == "70" { + 70 + } else if v == "71" { + 71 + } else if v == "72" { + 72 + } else if v == "73" { + 73 + } else if v == "74" { + 74 + } else if v == "75" { + 75 + } else if v == "76" { + 76 + } else if v == "77" { + 77 + } else if v == "78" { + 78 + } else if v == "79" { + 79 + } else if v == "80" { + 80 + } else if v == "81" { + 81 + } else if v == "82" { + 82 + } else if v == "83" { + 83 + } else if v == "84" { + 84 + } else if v == "85" { + 85 + } else if v == "86" { + 86 + } else if v == "87" { + 87 + } else if v == "88" { + 88 + } else if v == "89" { + 89 + } else if v == "90" { + 90 + } else if v == "91" { + 91 + } else if v == "92" { + 92 + } else if v == "93" { + 93 + } else if v == "94" { + 94 + } else if v == "95" { + 95 + } else if v == "96" { + 96 + } else if v == "97" { + 97 + } else if v == "98" { + 98 + } else if v == "99" { + 99 + } else if v == "100" { + 100 + } else if v == "101" { + 101 + } else if v == "102" { + 102 + } else if v == "103" { + 103 + } else if v == "104" { + 104 + } else if v == "105" { + 105 + } else if v == "106" { + 106 + } else if v == "107" { + 107 + } else if v == "108" { + 108 + } else if v == "109" { + 109 + } else if v == "110" { + 110 + } else if v == "111" { + 111 + } else if v == "112" { + 112 + } else if v == "113" { + 113 + } else if v == "114" { + 114 + } else if v == "115" { + 115 + } else if v == "116" { + 116 + } else if v == "117" { + 117 + } else if v == "118" { + 118 + } else if v == "119" { + 119 + } else if v == "120" { + 120 + } else if v == "121" { + 121 + } else if v == "122" { + 122 + } else if v == "123" { + 123 + } else if v == "124" { + 124 + } else if v == "125" { + 125 + } else if v == "126" { + 126 + } else if v == "127" { + 127 + } else if v == "128" { + 128 + } else if v == "129" { + 129 + } else if v == "130" { + 130 + } else if v == "131" { + 131 + } else if v == "132" { + 132 + } else if v == "133" { + 133 + } else if v == "134" { + 134 + } else if v == "135" { + 135 + } else if v == "136" { + 136 + } else if v == "137" { + 137 + } else if v == "138" { + 138 + } else if v == "139" { + 139 + } else if v == "140" { + 140 + } else if v == "141" { + 141 + } else if v == "142" { + 142 + } else if v == "143" { + 143 + } else if v == "144" { + 144 + } else if v == "145" { + 145 + } else if v == "146" { + 146 + } else if v == "147" { + 147 + } else if v == "148" { + 148 + } else if v == "149" { + 149 + } else if v == "150" { + 150 + } else if v == "151" { + 151 + } else if v == "152" { + 152 + } else if v == "153" { + 153 + } else if v == "154" { + 154 + } else if v == "155" { + 155 + } else if v == "156" { + 156 + } else if v == "157" { + 157 + } else if v == "158" { + 158 + } else if v == "159" { + 159 + } else if v == "160" { + 160 + } else if v == "161" { + 161 + } else if v == "162" { + 162 + } else if v == "163" { + 163 + } else if v == "164" { + 164 + } else if v == "165" { + 165 + } else if v == "166" { + 166 + } else if v == "167" { + 167 + } else if v == "168" { + 168 + } else if v == "169" { + 169 + } else if v == "170" { + 170 + } else if v == "171" { + 171 + } else if v == "172" { + 172 + } else if v == "173" { + 173 + } else if v == "174" { + 174 + } else if v == "175" { + 175 + } else if v == "176" { + 176 + } else if v == "177" { + 177 + } else if v == "178" { + 178 + } else if v == "179" { + 179 + } else if v == "180" { + 180 + } else if v == "181" { + 181 + } else if v == "182" { + 182 + } else if v == "183" { + 183 + } else if v == "184" { + 184 + } else if v == "185" { + 185 + } else if v == "186" { + 186 + } else if v == "187" { + 187 + } else if v == "188" { + 188 + } else if v == "189" { + 189 + } else if v == "190" { + 190 + } else if v == "191" { + 191 + } else if v == "192" { + 192 + } else if v == "193" { + 193 + } else if v == "194" { + 194 + } else if v == "195" { + 195 + } else if v == "196" { + 196 + } else if v == "197" { + 197 + } else if v == "198" { + 198 + } else if v == "199" { + 199 + } else if v == "200" { + 200 + } else if v == "201" { + 201 + } else if v == "202" { + 202 + } else if v == "203" { + 203 + } else if v == "204" { + 204 + } else if v == "205" { + 205 + } else if v == "206" { + 206 + } else if v == "207" { + 207 + } else if v == "208" { + 208 + } else if v == "209" { + 209 + } else if v == "210" { + 210 + } else if v == "211" { + 211 + } else if v == "212" { + 212 + } else if v == "213" { + 213 + } else if v == "214" { + 214 + } else if v == "215" { + 215 + } else if v == "216" { + 216 + } else if v == "217" { + 217 + } else if v == "218" { + 218 + } else if v == "219" { + 219 + } else if v == "220" { + 220 + } else if v == "221" { + 221 + } else if v == "222" { + 222 + } else if v == "223" { + 223 + } else if v == "224" { + 224 + } else if v == "225" { + 225 + } else if v == "226" { + 226 + } else if v == "227" { + 227 + } else if v == "228" { + 228 + } else if v == "229" { + 229 + } else if v == "230" { + 230 + } else if v == "231" { + 231 + } else if v == "232" { + 232 + } else if v == "233" { + 233 + } else if v == "234" { + 234 + } else if v == "235" { + 235 + } else if v == "236" { + 236 + } else if v == "237" { + 237 + } else if v == "238" { + 238 + } else if v == "239" { + 239 + } else if v == "240" { + 240 + } else if v == "241" { + 241 + } else if v == "242" { + 242 + } else if v == "243" { + 243 + } else if v == "244" { + 244 + } else if v == "245" { + 245 + } else if v == "246" { + 246 + } else if v == "247" { + 247 + } else if v == "248" { + 248 + } else if v == "249" { + 249 + } else if v == "250" { + 250 + } else if v == "251" { + 251 + } else if v == "252" { + 252 + } else if v == "253" { + 253 + } else if v == "254" { + 254 + } else if v == "255" { + 255 + } else if v == "256" { + 256 + } else if v == "257" { + 257 + } else if v == "258" { + 258 + } else if v == "259" { + 259 + } else if v == "260" { + 260 + } else if v == "261" { + 261 + } else if v == "262" { + 262 + } else if v == "263" { + 263 + } else if v == "264" { + 264 + } else if v == "265" { + 265 + } else if v == "266" { + 266 + } else if v == "267" { + 267 + } else if v == "268" { + 268 + } else if v == "269" { + 269 + } else if v == "270" { + 270 + } else if v == "271" { + 271 + } else if v == "272" { + 272 + } else if v == "273" { + 273 + } else if v == "274" { + 274 + } else if v == "275" { + 275 + } else if v == "276" { + 276 + } else if v == "277" { + 277 + } else if v == "278" { + 278 + } else if v == "279" { + 279 + } else if v == "280" { + 280 + } else if v == "281" { + 281 + } else if v == "282" { + 282 + } else if v == "283" { + 283 + } else if v == "284" { + 284 + } else if v == "285" { + 285 + } else if v == "286" { + 286 + } else if v == "287" { + 287 + } else if v == "288" { + 288 + } else if v == "289" { + 289 + } else if v == "290" { + 290 + } else if v == "291" { + 291 + } else if v == "292" { + 292 + } else if v == "293" { + 293 + } else if v == "294" { + 294 + } else if v == "295" { + 295 + } else if v == "296" { + 296 + } else if v == "297" { + 297 + } else if v == "298" { + 298 + } else if v == "299" { + 299 + } else if v == "300" { + 300 + } else if v == "301" { + 301 + } else if v == "302" { + 302 + } else if v == "303" { + 303 + } else if v == "304" { + 304 + } else if v == "305" { + 305 + } else if v == "306" { + 306 + } else if v == "307" { + 307 + } else if v == "308" { + 308 + } else if v == "309" { + 309 + } else if v == "310" { + 310 + } else if v == "311" { + 311 + } else if v == "312" { + 312 + } else if v == "313" { + 313 + } else if v == "314" { + 314 + } else if v == "315" { + 315 + } else if v == "316" { + 316 + } else if v == "317" { + 317 + } else if v == "318" { + 318 + } else if v == "319" { + 319 + } else if v == "320" { + 320 + } else if v == "321" { + 321 + } else if v == "322" { + 322 + } else if v == "323" { + 323 + } else if v == "324" { + 324 + } else if v == "325" { + 325 + } else if v == "326" { + 326 + } else if v == "327" { + 327 + } else if v == "328" { + 328 + } else if v == "329" { + 329 + } else if v == "330" { + 330 + } else if v == "331" { + 331 + } else if v == "332" { + 332 + } else if v == "333" { + 333 + } else if v == "334" { + 334 + } else if v == "335" { + 335 + } else if v == "336" { + 336 + } else if v == "337" { + 337 + } else if v == "338" { + 338 + } else if v == "339" { + 339 + } else if v == "340" { + 340 + } else if v == "341" { + 341 + } else if v == "342" { + 342 + } else if v == "343" { + 343 + } else if v == "344" { + 344 + } else if v == "345" { + 345 + } else if v == "346" { + 346 + } else if v == "347" { + 347 + } else if v == "348" { + 348 + } else if v == "349" { + 349 + } else if v == "350" { + 350 + } else if v == "351" { + 351 + } else if v == "352" { + 352 + } else if v == "353" { + 353 + } else if v == "354" { + 354 + } else if v == "355" { + 355 + } else if v == "356" { + 356 + } else if v == "357" { + 357 + } else if v == "358" { + 358 + } else if v == "359" { + 359 + } else if v == "360" { + 360 + } else if v == "361" { + 361 + } else if v == "362" { + 362 + } else if v == "363" { + 363 + } else if v == "364" { + 364 + } else if v == "365" { + 365 + } else if v == "366" { + 366 + } else if v == "367" { + 367 + } else if v == "368" { + 368 + } else if v == "369" { + 369 + } else if v == "370" { + 370 + } else if v == "371" { + 371 + } else if v == "372" { + 372 + } else if v == "373" { + 373 + } else if v == "374" { + 374 + } else if v == "375" { + 375 + } else if v == "376" { + 376 + } else if v == "377" { + 377 + } else if v == "378" { + 378 + } else if v == "379" { + 379 + } else if v == "380" { + 380 + } else if v == "381" { + 381 + } else if v == "382" { + 382 + } else if v == "383" { + 383 + } else if v == "384" { + 384 + } else if v == "385" { + 385 + } else if v == "386" { + 386 + } else if v == "387" { + 387 + } else if v == "388" { + 388 + } else if v == "389" { + 389 + } else if v == "390" { + 390 + } else if v == "391" { + 391 + } else if v == "392" { + 392 + } else if v == "393" { + 393 + } else if v == "394" { + 394 + } else if v == "395" { + 395 + } else if v == "396" { + 396 + } else if v == "397" { + 397 + } else if v == "398" { + 398 + } else if v == "399" { + 399 + } else if v == "400" { + 400 + } else if v == "401" { + 401 + } else if v == "402" { + 402 + } else if v == "403" { + 403 + } else if v == "404" { + 404 + } else if v == "405" { + 405 + } else if v == "406" { + 406 + } else if v == "407" { + 407 + } else if v == "408" { + 408 + } else if v == "409" { + 409 + } else if v == "410" { + 410 + } else if v == "411" { + 411 + } else if v == "412" { + 412 + } else if v == "413" { + 413 + } else if v == "414" { + 414 + } else if v == "415" { + 415 + } else if v == "416" { + 416 + } else if v == "417" { + 417 + } else if v == "418" { + 418 + } else if v == "419" { + 419 + } else if v == "420" { + 420 + } else if v == "421" { + 421 + } else if v == "422" { + 422 + } else if v == "423" { + 423 + } else if v == "424" { + 424 + } else if v == "425" { + 425 + } else if v == "426" { + 426 + } else if v == "427" { + 427 + } else if v == "428" { + 428 + } else if v == "429" { + 429 + } else if v == "430" { + 430 + } else if v == "431" { + 431 + } else if v == "432" { + 432 + } else if v == "433" { + 433 + } else if v == "434" { + 434 + } else if v == "435" { + 435 + } else if v == "436" { + 436 + } else if v == "437" { + 437 + } else if v == "438" { + 438 + } else if v == "439" { + 439 + } else if v == "440" { + 440 + } else if v == "441" { + 441 + } else if v == "442" { + 442 + } else if v == "443" { + 443 + } else if v == "444" { + 444 + } else if v == "445" { + 445 + } else if v == "446" { + 446 + } else if v == "447" { + 447 + } else if v == "448" { + 448 + } else if v == "449" { + 449 + } else if v == "450" { + 450 + } else if v == "451" { + 451 + } else if v == "452" { + 452 + } else if v == "453" { + 453 + } else if v == "454" { + 454 + } else if v == "455" { + 455 + } else if v == "456" { + 456 + } else if v == "457" { + 457 + } else if v == "458" { + 458 + } else if v == "459" { + 459 + } else if v == "460" { + 460 + } else if v == "461" { + 461 + } else if v == "462" { + 462 + } else if v == "463" { + 463 + } else if v == "464" { + 464 + } else if v == "465" { + 465 + } else if v == "466" { + 466 + } else if v == "467" { + 467 + } else if v == "468" { + 468 + } else if v == "469" { + 469 + } else if v == "470" { + 470 + } else if v == "471" { + 471 + } else if v == "472" { + 472 + } else if v == "473" { + 473 + } else if v == "474" { + 474 + } else if v == "475" { + 475 + } else if v == "476" { + 476 + } else if v == "477" { + 477 + } else if v == "478" { + 478 + } else if v == "479" { + 479 + } else if v == "480" { + 480 + } else if v == "481" { + 481 + } else if v == "482" { + 482 + } else if v == "483" { + 483 + } else if v == "484" { + 484 + } else if v == "485" { + 485 + } else if v == "486" { + 486 + } else if v == "487" { + 487 + } else if v == "488" { + 488 + } else if v == "489" { + 489 + } else if v == "490" { + 490 + } else if v == "491" { + 491 + } else if v == "492" { + 492 + } else if v == "493" { + 493 + } else if v == "494" { + 494 + } else if v == "495" { + 495 + } else if v == "496" { + 496 + } else if v == "497" { + 497 + } else if v == "498" { + 498 + } else if v == "499" { + 499 + } else if v == "500" { + 500 + } else if v == "501" { + 501 + } else if v == "502" { + 502 + } else if v == "503" { + 503 + } else if v == "504" { + 504 + } else if v == "505" { + 505 + } else if v == "506" { + 506 + } else if v == "507" { + 507 + } else if v == "508" { + 508 + } else if v == "509" { + 509 + } else if v == "510" { + 510 + } else if v == "511" { + 511 + } else if v == "512" { + 512 + } else if v == "513" { + 513 + } else if v == "514" { + 514 + } else if v == "515" { + 515 + } else if v == "516" { + 516 + } else if v == "517" { + 517 + } else if v == "518" { + 518 + } else if v == "519" { + 519 + } else if v == "520" { + 520 + } else if v == "521" { + 521 + } else if v == "522" { + 522 + } else if v == "523" { + 523 + } else if v == "524" { + 524 + } else if v == "525" { + 525 + } else if v == "526" { + 526 + } else if v == "527" { + 527 + } else if v == "528" { + 528 + } else if v == "529" { + 529 + } else if v == "530" { + 530 + } else if v == "531" { + 531 + } else if v == "532" { + 532 + } else if v == "533" { + 533 + } else if v == "534" { + 534 + } else if v == "535" { + 535 + } else if v == "536" { + 536 + } else if v == "537" { + 537 + } else if v == "538" { + 538 + } else if v == "539" { + 539 + } else if v == "540" { + 540 + } else if v == "541" { + 541 + } else if v == "542" { + 542 + } else if v == "543" { + 543 + } else if v == "544" { + 544 + } else if v == "545" { + 545 + } else if v == "546" { + 546 + } else if v == "547" { + 547 + } else if v == "548" { + 548 + } else if v == "549" { + 549 + } else if v == "550" { + 550 + } else if v == "551" { + 551 + } else if v == "552" { + 552 + } else if v == "553" { + 553 + } else if v == "554" { + 554 + } else if v == "555" { + 555 + } else if v == "556" { + 556 + } else if v == "557" { + 557 + } else if v == "558" { + 558 + } else if v == "559" { + 559 + } else if v == "560" { + 560 + } else if v == "561" { + 561 + } else if v == "562" { + 562 + } else if v == "563" { + 563 + } else if v == "564" { + 564 + } else if v == "565" { + 565 + } else if v == "566" { + 566 + } else if v == "567" { + 567 + } else if v == "568" { + 568 + } else if v == "569" { + 569 + } else if v == "570" { + 570 + } else if v == "571" { + 571 + } else if v == "572" { + 572 + } else if v == "573" { + 573 + } else if v == "574" { + 574 + } else if v == "575" { + 575 + } else if v == "576" { + 576 + } else if v == "577" { + 577 + } else if v == "578" { + 578 + } else if v == "579" { + 579 + } else if v == "580" { + 580 + } else if v == "581" { + 581 + } else if v == "582" { + 582 + } else if v == "583" { + 583 + } else if v == "584" { + 584 + } else if v == "585" { + 585 + } else if v == "586" { + 586 + } else if v == "587" { + 587 + } else if v == "588" { + 588 + } else if v == "589" { + 589 + } else if v == "590" { + 590 + } else if v == "591" { + 591 + } else if v == "592" { + 592 + } else if v == "593" { + 593 + } else if v == "594" { + 594 + } else if v == "595" { + 595 + } else if v == "596" { + 596 + } else if v == "597" { + 597 + } else if v == "598" { + 598 + } else if v == "599" { + 599 + } else if v == "600" { + 600 + } else if v == "601" { + 601 + } else if v == "602" { + 602 + } else if v == "603" { + 603 + } else if v == "604" { + 604 + } else if v == "605" { + 605 + } else if v == "606" { + 606 + } else if v == "607" { + 607 + } else if v == "608" { + 608 + } else if v == "609" { + 609 + } else if v == "610" { + 610 + } else if v == "611" { + 611 + } else if v == "612" { + 612 + } else if v == "613" { + 613 + } else if v == "614" { + 614 + } else if v == "615" { + 615 + } else if v == "616" { + 616 + } else if v == "617" { + 617 + } else if v == "618" { + 618 + } else if v == "619" { + 619 + } else if v == "620" { + 620 + } else if v == "621" { + 621 + } else if v == "622" { + 622 + } else if v == "623" { + 623 + } else if v == "624" { + 624 + } else if v == "625" { + 625 + } else if v == "626" { + 626 + } else if v == "627" { + 627 + } else if v == "628" { + 628 + } else if v == "629" { + 629 + } else if v == "630" { + 630 + } else if v == "631" { + 631 + } else if v == "632" { + 632 + } else if v == "633" { + 633 + } else if v == "634" { + 634 + } else if v == "635" { + 635 + } else if v == "636" { + 636 + } else if v == "637" { + 637 + } else if v == "638" { + 638 + } else if v == "639" { + 639 + } else if v == "640" { + 640 + } else if v == "641" { + 641 + } else if v == "642" { + 642 + } else if v == "643" { + 643 + } else if v == "644" { + 644 + } else if v == "645" { + 645 + } else if v == "646" { + 646 + } else if v == "647" { + 647 + } else if v == "648" { + 648 + } else if v == "649" { + 649 + } else if v == "650" { + 650 + } else if v == "651" { + 651 + } else if v == "652" { + 652 + } else if v == "653" { + 653 + } else if v == "654" { + 654 + } else if v == "655" { + 655 + } else if v == "656" { + 656 + } else if v == "657" { + 657 + } else if v == "658" { + 658 + } else if v == "659" { + 659 + } else if v == "660" { + 660 + } else if v == "661" { + 661 + } else if v == "662" { + 662 + } else if v == "663" { + 663 + } else if v == "664" { + 664 + } else if v == "665" { + 665 + } else if v == "666" { + 666 + } else if v == "667" { + 667 + } else if v == "668" { + 668 + } else if v == "669" { + 669 + } else if v == "670" { + 670 + } else if v == "671" { + 671 + } else if v == "672" { + 672 + } else if v == "673" { + 673 + } else if v == "674" { + 674 + } else if v == "675" { + 675 + } else if v == "676" { + 676 + } else if v == "677" { + 677 + } else if v == "678" { + 678 + } else if v == "679" { + 679 + } else if v == "680" { + 680 + } else if v == "681" { + 681 + } else if v == "682" { + 682 + } else if v == "683" { + 683 + } else if v == "684" { + 684 + } else if v == "685" { + 685 + } else if v == "686" { + 686 + } else if v == "687" { + 687 + } else if v == "688" { + 688 + } else if v == "689" { + 689 + } else if v == "690" { + 690 + } else if v == "691" { + 691 + } else if v == "692" { + 692 + } else if v == "693" { + 693 + } else if v == "694" { + 694 + } else if v == "695" { + 695 + } else if v == "696" { + 696 + } else if v == "697" { + 697 + } else if v == "698" { + 698 + } else if v == "699" { + 699 + } else if v == "700" { + 700 + } else if v == "701" { + 701 + } else if v == "702" { + 702 + } else if v == "703" { + 703 + } else if v == "704" { + 704 + } else if v == "705" { + 705 + } else if v == "706" { + 706 + } else if v == "707" { + 707 + } else if v == "708" { + 708 + } else if v == "709" { + 709 + } else if v == "710" { + 710 + } else if v == "711" { + 711 + } else if v == "712" { + 712 + } else if v == "713" { + 713 + } else if v == "714" { + 714 + } else if v == "715" { + 715 + } else if v == "716" { + 716 + } else if v == "717" { + 717 + } else if v == "718" { + 718 + } else if v == "719" { + 719 + } else if v == "720" { + 720 + } else if v == "721" { + 721 + } else if v == "722" { + 722 + } else if v == "723" { + 723 + } else if v == "724" { + 724 + } else if v == "725" { + 725 + } else if v == "726" { + 726 + } else if v == "727" { + 727 + } else if v == "728" { + 728 + } else if v == "729" { + 729 + } else if v == "730" { + 730 + } else if v == "731" { + 731 + } else if v == "732" { + 732 + } else if v == "733" { + 733 + } else if v == "734" { + 734 + } else if v == "735" { + 735 + } else if v == "736" { + 736 + } else if v == "737" { + 737 + } else if v == "738" { + 738 + } else if v == "739" { + 739 + } else if v == "740" { + 740 + } else if v == "741" { + 741 + } else if v == "742" { + 742 + } else if v == "743" { + 743 + } else if v == "744" { + 744 + } else if v == "745" { + 745 + } else if v == "746" { + 746 + } else if v == "747" { + 747 + } else if v == "748" { + 748 + } else if v == "749" { + 749 + } else if v == "750" { + 750 + } else if v == "751" { + 751 + } else if v == "752" { + 752 + } else if v == "753" { + 753 + } else if v == "754" { + 754 + } else if v == "755" { + 755 + } else if v == "756" { + 756 + } else if v == "757" { + 757 + } else if v == "758" { + 758 + } else if v == "759" { + 759 + } else if v == "760" { + 760 + } else if v == "761" { + 761 + } else if v == "762" { + 762 + } else if v == "763" { + 763 + } else if v == "764" { + 764 + } else if v == "765" { + 765 + } else if v == "766" { + 766 + } else if v == "767" { + 767 + } else if v == "768" { + 768 + } else if v == "769" { + 769 + } else if v == "770" { + 770 + } else if v == "771" { + 771 + } else if v == "772" { + 772 + } else if v == "773" { + 773 + } else if v == "774" { + 774 + } else if v == "775" { + 775 + } else if v == "776" { + 776 + } else if v == "777" { + 777 + } else if v == "778" { + 778 + } else if v == "779" { + 779 + } else if v == "780" { + 780 + } else if v == "781" { + 781 + } else if v == "782" { + 782 + } else if v == "783" { + 783 + } else if v == "784" { + 784 + } else if v == "785" { + 785 + } else if v == "786" { + 786 + } else if v == "787" { + 787 + } else if v == "788" { + 788 + } else if v == "789" { + 789 + } else if v == "790" { + 790 + } else if v == "791" { + 791 + } else if v == "792" { + 792 + } else if v == "793" { + 793 + } else if v == "794" { + 794 + } else if v == "795" { + 795 + } else if v == "796" { + 796 + } else if v == "797" { + 797 + } else if v == "798" { + 798 + } else if v == "799" { + 799 + } else if v == "800" { + 800 + } else if v == "801" { + 801 + } else if v == "802" { + 802 + } else if v == "803" { + 803 + } else if v == "804" { + 804 + } else if v == "805" { + 805 + } else if v == "806" { + 806 + } else if v == "807" { + 807 + } else if v == "808" { + 808 + } else if v == "809" { + 809 + } else if v == "810" { + 810 + } else if v == "811" { + 811 + } else if v == "812" { + 812 + } else if v == "813" { + 813 + } else if v == "814" { + 814 + } else if v == "815" { + 815 + } else if v == "816" { + 816 + } else if v == "817" { + 817 + } else if v == "818" { + 818 + } else if v == "819" { + 819 + } else if v == "820" { + 820 + } else if v == "821" { + 821 + } else if v == "822" { + 822 + } else if v == "823" { + 823 + } else if v == "824" { + 824 + } else if v == "825" { + 825 + } else if v == "826" { + 826 + } else if v == "827" { + 827 + } else if v == "828" { + 828 + } else if v == "829" { + 829 + } else if v == "830" { + 830 + } else if v == "831" { + 831 + } else if v == "832" { + 832 + } else if v == "833" { + 833 + } else if v == "834" { + 834 + } else if v == "835" { + 835 + } else if v == "836" { + 836 + } else if v == "837" { + 837 + } else if v == "838" { + 838 + } else if v == "839" { + 839 + } else if v == "840" { + 840 + } else if v == "841" { + 841 + } else if v == "842" { + 842 + } else if v == "843" { + 843 + } else if v == "844" { + 844 + } else if v == "845" { + 845 + } else if v == "846" { + 846 + } else if v == "847" { + 847 + } else if v == "848" { + 848 + } else if v == "849" { + 849 + } else if v == "850" { + 850 + } else if v == "851" { + 851 + } else if v == "852" { + 852 + } else if v == "853" { + 853 + } else if v == "854" { + 854 + } else if v == "855" { + 855 + } else if v == "856" { + 856 + } else if v == "857" { + 857 + } else if v == "858" { + 858 + } else if v == "859" { + 859 + } else if v == "860" { + 860 + } else if v == "861" { + 861 + } else if v == "862" { + 862 + } else if v == "863" { + 863 + } else if v == "864" { + 864 + } else if v == "865" { + 865 + } else if v == "866" { + 866 + } else if v == "867" { + 867 + } else if v == "868" { + 868 + } else if v == "869" { + 869 + } else if v == "870" { + 870 + } else if v == "871" { + 871 + } else if v == "872" { + 872 + } else if v == "873" { + 873 + } else if v == "874" { + 874 + } else if v == "875" { + 875 + } else if v == "876" { + 876 + } else if v == "877" { + 877 + } else if v == "878" { + 878 + } else if v == "879" { + 879 + } else if v == "880" { + 880 + } else if v == "881" { + 881 + } else if v == "882" { + 882 + } else if v == "883" { + 883 + } else if v == "884" { + 884 + } else if v == "885" { + 885 + } else if v == "886" { + 886 + } else if v == "887" { + 887 + } else if v == "888" { + 888 + } else if v == "889" { + 889 + } else if v == "890" { + 890 + } else if v == "891" { + 891 + } else if v == "892" { + 892 + } else if v == "893" { + 893 + } else if v == "894" { + 894 + } else if v == "895" { + 895 + } else if v == "896" { + 896 + } else if v == "897" { + 897 + } else if v == "898" { + 898 + } else if v == "899" { + 899 + } else if v == "900" { + 900 + } else if v == "901" { + 901 + } else if v == "902" { + 902 + } else if v == "903" { + 903 + } else if v == "904" { + 904 + } else if v == "905" { + 905 + } else if v == "906" { + 906 + } else if v == "907" { + 907 + } else if v == "908" { + 908 + } else if v == "909" { + 909 + } else if v == "910" { + 910 + } else if v == "911" { + 911 + } else if v == "912" { + 912 + } else if v == "913" { + 913 + } else if v == "914" { + 914 + } else if v == "915" { + 915 + } else if v == "916" { + 916 + } else if v == "917" { + 917 + } else if v == "918" { + 918 + } else if v == "919" { + 919 + } else if v == "920" { + 920 + } else if v == "921" { + 921 + } else if v == "922" { + 922 + } else if v == "923" { + 923 + } else if v == "924" { + 924 + } else if v == "925" { + 925 + } else if v == "926" { + 926 + } else if v == "927" { + 927 + } else if v == "928" { + 928 + } else if v == "929" { + 929 + } else if v == "930" { + 930 + } else if v == "931" { + 931 + } else if v == "932" { + 932 + } else if v == "933" { + 933 + } else if v == "934" { + 934 + } else if v == "935" { + 935 + } else if v == "936" { + 936 + } else if v == "937" { + 937 + } else if v == "938" { + 938 + } else if v == "939" { + 939 + } else if v == "940" { + 940 + } else if v == "941" { + 941 + } else if v == "942" { + 942 + } else if v == "943" { + 943 + } else if v == "944" { + 944 + } else if v == "945" { + 945 + } else if v == "946" { + 946 + } else if v == "947" { + 947 + } else if v == "948" { + 948 + } else if v == "949" { + 949 + } else if v == "950" { + 950 + } else if v == "951" { + 951 + } else if v == "952" { + 952 + } else if v == "953" { + 953 + } else if v == "954" { + 954 + } else if v == "955" { + 955 + } else if v == "956" { + 956 + } else if v == "957" { + 957 + } else if v == "958" { + 958 + } else if v == "959" { + 959 + } else if v == "960" { + 960 + } else if v == "961" { + 961 + } else if v == "962" { + 962 + } else if v == "963" { + 963 + } else if v == "964" { + 964 + } else if v == "965" { + 965 + } else if v == "966" { + 966 + } else if v == "967" { + 967 + } else if v == "968" { + 968 + } else if v == "969" { + 969 + } else if v == "970" { + 970 + } else if v == "971" { + 971 + } else if v == "972" { + 972 + } else if v == "973" { + 973 + } else if v == "974" { + 974 + } else if v == "975" { + 975 + } else if v == "976" { + 976 + } else if v == "977" { + 977 + } else if v == "978" { + 978 + } else if v == "979" { + 979 + } else if v == "980" { + 980 + } else if v == "981" { + 981 + } else if v == "982" { + 982 + } else if v == "983" { + 983 + } else if v == "984" { + 984 + } else if v == "985" { + 985 + } else if v == "986" { + 986 + } else if v == "987" { + 987 + } else if v == "988" { + 988 + } else if v == "989" { + 989 + } else if v == "990" { + 990 + } else if v == "991" { + 991 + } else if v == "992" { + 992 + } else if v == "993" { + 993 + } else if v == "994" { + 994 + } else if v == "995" { + 995 + } else if v == "996" { + 996 + } else if v == "997" { + 997 + } else if v == "998" { + 998 + } else if v == "999" { + 999 + } else if v == "1000" { + 1000 + } else if v == "1001" { + 1001 + } else if v == "1002" { + 1002 + } else if v == "1003" { + 1003 + } else if v == "1004" { + 1004 + } else if v == "1005" { + 1005 + } else if v == "1006" { + 1006 + } else if v == "1007" { + 1007 + } else if v == "1008" { + 1008 + } else if v == "1009" { + 1009 + } else if v == "1010" { + 1010 + } else if v == "1011" { + 1011 + } else if v == "1012" { + 1012 + } else if v == "1013" { + 1013 + } else if v == "1014" { + 1014 + } else if v == "1015" { + 1015 + } else if v == "1016" { + 1016 + } else if v == "1017" { + 1017 + } else if v == "1018" { + 1018 + } else if v == "1019" { + 1019 + } else if v == "1020" { + 1020 + } else if v == "1021" { + 1021 + } else if v == "1022" { + 1022 + } else if v == "1023" { + 1023 + } else if v == "1024" { + 1024 + } else if v == "1025" { + 1025 + } else if v == "1026" { + 1026 + } else if v == "1027" { + 1027 + } else if v == "1028" { + 1028 + } else if v == "1029" { + 1029 + } else if v == "1030" { + 1030 + } else if v == "1031" { + 1031 + } else if v == "1032" { + 1032 + } else if v == "1033" { + 1033 + } else if v == "1034" { + 1034 + } else if v == "1035" { + 1035 + } else if v == "1036" { + 1036 + } else if v == "1037" { + 1037 + } else if v == "1038" { + 1038 + } else if v == "1039" { + 1039 + } else if v == "1040" { + 1040 + } else if v == "1041" { + 1041 + } else if v == "1042" { + 1042 + } else if v == "1043" { + 1043 + } else if v == "1044" { + 1044 + } else if v == "1045" { + 1045 + } else if v == "1046" { + 1046 + } else if v == "1047" { + 1047 + } else if v == "1048" { + 1048 + } else if v == "1049" { + 1049 + } else if v == "1050" { + 1050 + } else if v == "1051" { + 1051 + } else if v == "1052" { + 1052 + } else if v == "1053" { + 1053 + } else if v == "1054" { + 1054 + } else if v == "1055" { + 1055 + } else if v == "1056" { + 1056 + } else if v == "1057" { + 1057 + } else if v == "1058" { + 1058 + } else if v == "1059" { + 1059 + } else if v == "1060" { + 1060 + } else if v == "1061" { + 1061 + } else if v == "1062" { + 1062 + } else if v == "1063" { + 1063 + } else if v == "1064" { + 1064 + } else if v == "1065" { + 1065 + } else if v == "1066" { + 1066 + } else if v == "1067" { + 1067 + } else if v == "1068" { + 1068 + } else if v == "1069" { + 1069 + } else if v == "1070" { + 1070 + } else if v == "1071" { + 1071 + } else if v == "1072" { + 1072 + } else if v == "1073" { + 1073 + } else if v == "1074" { + 1074 + } else if v == "1075" { + 1075 + } else if v == "1076" { + 1076 + } else if v == "1077" { + 1077 + } else if v == "1078" { + 1078 + } else if v == "1079" { + 1079 + } else if v == "1080" { + 1080 + } else if v == "1081" { + 1081 + } else if v == "1082" { + 1082 + } else if v == "1083" { + 1083 + } else if v == "1084" { + 1084 + } else if v == "1085" { + 1085 + } else if v == "1086" { + 1086 + } else if v == "1087" { + 1087 + } else if v == "1088" { + 1088 + } else if v == "1089" { + 1089 + } else if v == "1090" { + 1090 + } else if v == "1091" { + 1091 + } else if v == "1092" { + 1092 + } else if v == "1093" { + 1093 + } else if v == "1094" { + 1094 + } else if v == "1095" { + 1095 + } else if v == "1096" { + 1096 + } else if v == "1097" { + 1097 + } else if v == "1098" { + 1098 + } else if v == "1099" { + 1099 + } else if v == "1100" { + 1100 + } else if v == "1101" { + 1101 + } else if v == "1102" { + 1102 + } else if v == "1103" { + 1103 + } else if v == "1104" { + 1104 + } else if v == "1105" { + 1105 + } else if v == "1106" { + 1106 + } else if v == "1107" { + 1107 + } else if v == "1108" { + 1108 + } else if v == "1109" { + 1109 + } else if v == "1110" { + 1110 + } else if v == "1111" { + 1111 + } else if v == "1112" { + 1112 + } else if v == "1113" { + 1113 + } else if v == "1114" { + 1114 + } else if v == "1115" { + 1115 + } else if v == "1116" { + 1116 + } else if v == "1117" { + 1117 + } else if v == "1118" { + 1118 + } else if v == "1119" { + 1119 + } else if v == "1120" { + 1120 + } else if v == "1121" { + 1121 + } else if v == "1122" { + 1122 + } else if v == "1123" { + 1123 + } else if v == "1124" { + 1124 + } else if v == "1125" { + 1125 + } else if v == "1126" { + 1126 + } else if v == "1127" { + 1127 + } else if v == "1128" { + 1128 + } else if v == "1129" { + 1129 + } else if v == "1130" { + 1130 + } else if v == "1131" { + 1131 + } else if v == "1132" { + 1132 + } else if v == "1133" { + 1133 + } else if v == "1134" { + 1134 + } else if v == "1135" { + 1135 + } else if v == "1136" { + 1136 + } else if v == "1137" { + 1137 + } else if v == "1138" { + 1138 + } else if v == "1139" { + 1139 + } else if v == "1140" { + 1140 + } else if v == "1141" { + 1141 + } else if v == "1142" { + 1142 + } else if v == "1143" { + 1143 + } else if v == "1144" { + 1144 + } else if v == "1145" { + 1145 + } else if v == "1146" { + 1146 + } else if v == "1147" { + 1147 + } else if v == "1148" { + 1148 + } else if v == "1149" { + 1149 + } else if v == "1150" { + 1150 + } else if v == "1151" { + 1151 + } else if v == "1152" { + 1152 + } else if v == "1153" { + 1153 + } else if v == "1154" { + 1154 + } else if v == "1155" { + 1155 + } else if v == "1156" { + 1156 + } else if v == "1157" { + 1157 + } else if v == "1158" { + 1158 + } else if v == "1159" { + 1159 + } else if v == "1160" { + 1160 + } else if v == "1161" { + 1161 + } else if v == "1162" { + 1162 + } else if v == "1163" { + 1163 + } else if v == "1164" { + 1164 + } else if v == "1165" { + 1165 + } else if v == "1166" { + 1166 + } else if v == "1167" { + 1167 + } else if v == "1168" { + 1168 + } else if v == "1169" { + 1169 + } else if v == "1170" { + 1170 + } else if v == "1171" { + 1171 + } else if v == "1172" { + 1172 + } else if v == "1173" { + 1173 + } else if v == "1174" { + 1174 + } else if v == "1175" { + 1175 + } else if v == "1176" { + 1176 + } else if v == "1177" { + 1177 + } else if v == "1178" { + 1178 + } else if v == "1179" { + 1179 + } else if v == "1180" { + 1180 + } else if v == "1181" { + 1181 + } else if v == "1182" { + 1182 + } else if v == "1183" { + 1183 + } else if v == "1184" { + 1184 + } else if v == "1185" { + 1185 + } else if v == "1186" { + 1186 + } else if v == "1187" { + 1187 + } else if v == "1188" { + 1188 + } else if v == "1189" { + 1189 + } else if v == "1190" { + 1190 + } else if v == "1191" { + 1191 + } else if v == "1192" { + 1192 + } else if v == "1193" { + 1193 + } else if v == "1194" { + 1194 + } else if v == "1195" { + 1195 + } else if v == "1196" { + 1196 + } else if v == "1197" { + 1197 + } else if v == "1198" { + 1198 + } else if v == "1199" { + 1199 + } else if v == "1200" { + 1200 + } else if v == "1201" { + 1201 + } else if v == "1202" { + 1202 + } else if v == "1203" { + 1203 + } else if v == "1204" { + 1204 + } else if v == "1205" { + 1205 + } else if v == "1206" { + 1206 + } else if v == "1207" { + 1207 + } else if v == "1208" { + 1208 + } else if v == "1209" { + 1209 + } else if v == "1210" { + 1210 + } else if v == "1211" { + 1211 + } else if v == "1212" { + 1212 + } else if v == "1213" { + 1213 + } else if v == "1214" { + 1214 + } else if v == "1215" { + 1215 + } else if v == "1216" { + 1216 + } else if v == "1217" { + 1217 + } else if v == "1218" { + 1218 + } else if v == "1219" { + 1219 + } else if v == "1220" { + 1220 + } else if v == "1221" { + 1221 + } else if v == "1222" { + 1222 + } else if v == "1223" { + 1223 + } else if v == "1224" { + 1224 + } else if v == "1225" { + 1225 + } else if v == "1226" { + 1226 + } else if v == "1227" { + 1227 + } else if v == "1228" { + 1228 + } else if v == "1229" { + 1229 + } else if v == "1230" { + 1230 + } else if v == "1231" { + 1231 + } else if v == "1232" { + 1232 + } else if v == "1233" { + 1233 + } else if v == "1234" { + 1234 + } else if v == "1235" { + 1235 + } else if v == "1236" { + 1236 + } else if v == "1237" { + 1237 + } else if v == "1238" { + 1238 + } else if v == "1239" { + 1239 + } else if v == "1240" { + 1240 + } else if v == "1241" { + 1241 + } else if v == "1242" { + 1242 + } else if v == "1243" { + 1243 + } else if v == "1244" { + 1244 + } else if v == "1245" { + 1245 + } else if v == "1246" { + 1246 + } else if v == "1247" { + 1247 + } else if v == "1248" { + 1248 + } else if v == "1249" { + 1249 + } else if v == "1250" { + 1250 + } else if v == "1251" { + 1251 + } else if v == "1252" { + 1252 + } else if v == "1253" { + 1253 + } else if v == "1254" { + 1254 + } else if v == "1255" { + 1255 + } else if v == "1256" { + 1256 + } else if v == "1257" { + 1257 + } else if v == "1258" { + 1258 + } else if v == "1259" { + 1259 + } else if v == "1260" { + 1260 + } else if v == "1261" { + 1261 + } else if v == "1262" { + 1262 + } else if v == "1263" { + 1263 + } else if v == "1264" { + 1264 + } else if v == "1265" { + 1265 + } else if v == "1266" { + 1266 + } else if v == "1267" { + 1267 + } else if v == "1268" { + 1268 + } else if v == "1269" { + 1269 + } else if v == "1270" { + 1270 + } else if v == "1271" { + 1271 + } else if v == "1272" { + 1272 + } else if v == "1273" { + 1273 + } else if v == "1274" { + 1274 + } else if v == "1275" { + 1275 + } else if v == "1276" { + 1276 + } else if v == "1277" { + 1277 + } else if v == "1278" { + 1278 + } else if v == "1279" { + 1279 + } else if v == "1280" { + 1280 + } else if v == "1281" { + 1281 + } else if v == "1282" { + 1282 + } else if v == "1283" { + 1283 + } else if v == "1284" { + 1284 + } else if v == "1285" { + 1285 + } else if v == "1286" { + 1286 + } else if v == "1287" { + 1287 + } else if v == "1288" { + 1288 + } else if v == "1289" { + 1289 + } else if v == "1290" { + 1290 + } else if v == "1291" { + 1291 + } else if v == "1292" { + 1292 + } else if v == "1293" { + 1293 + } else if v == "1294" { + 1294 + } else if v == "1295" { + 1295 + } else if v == "1296" { + 1296 + } else if v == "1297" { + 1297 + } else if v == "1298" { + 1298 + } else if v == "1299" { + 1299 + } else if v == "1300" { + 1300 + } else if v == "1301" { + 1301 + } else if v == "1302" { + 1302 + } else if v == "1303" { + 1303 + } else if v == "1304" { + 1304 + } else if v == "1305" { + 1305 + } else if v == "1306" { + 1306 + } else if v == "1307" { + 1307 + } else if v == "1308" { + 1308 + } else if v == "1309" { + 1309 + } else if v == "1310" { + 1310 + } else if v == "1311" { + 1311 + } else if v == "1312" { + 1312 + } else if v == "1313" { + 1313 + } else if v == "1314" { + 1314 + } else if v == "1315" { + 1315 + } else if v == "1316" { + 1316 + } else if v == "1317" { + 1317 + } else if v == "1318" { + 1318 + } else if v == "1319" { + 1319 + } else if v == "1320" { + 1320 + } else if v == "1321" { + 1321 + } else if v == "1322" { + 1322 + } else if v == "1323" { + 1323 + } else if v == "1324" { + 1324 + } else if v == "1325" { + 1325 + } else if v == "1326" { + 1326 + } else if v == "1327" { + 1327 + } else if v == "1328" { + 1328 + } else if v == "1329" { + 1329 + } else if v == "1330" { + 1330 + } else if v == "1331" { + 1331 + } else if v == "1332" { + 1332 + } else if v == "1333" { + 1333 + } else if v == "1334" { + 1334 + } else if v == "1335" { + 1335 + } else if v == "1336" { + 1336 + } else if v == "1337" { + 1337 + } else if v == "1338" { + 1338 + } else if v == "1339" { + 1339 + } else if v == "1340" { + 1340 + } else if v == "1341" { + 1341 + } else if v == "1342" { + 1342 + } else if v == "1343" { + 1343 + } else if v == "1344" { + 1344 + } else if v == "1345" { + 1345 + } else if v == "1346" { + 1346 + } else if v == "1347" { + 1347 + } else if v == "1348" { + 1348 + } else if v == "1349" { + 1349 + } else if v == "1350" { + 1350 + } else if v == "1351" { + 1351 + } else if v == "1352" { + 1352 + } else if v == "1353" { + 1353 + } else if v == "1354" { + 1354 + } else if v == "1355" { + 1355 + } else if v == "1356" { + 1356 + } else if v == "1357" { + 1357 + } else if v == "1358" { + 1358 + } else if v == "1359" { + 1359 + } else if v == "1360" { + 1360 + } else if v == "1361" { + 1361 + } else if v == "1362" { + 1362 + } else if v == "1363" { + 1363 + } else if v == "1364" { + 1364 + } else if v == "1365" { + 1365 + } else if v == "1366" { + 1366 + } else if v == "1367" { + 1367 + } else if v == "1368" { + 1368 + } else if v == "1369" { + 1369 + } else if v == "1370" { + 1370 + } else if v == "1371" { + 1371 + } else if v == "1372" { + 1372 + } else if v == "1373" { + 1373 + } else if v == "1374" { + 1374 + } else if v == "1375" { + 1375 + } else if v == "1376" { + 1376 + } else if v == "1377" { + 1377 + } else if v == "1378" { + 1378 + } else if v == "1379" { + 1379 + } else if v == "1380" { + 1380 + } else if v == "1381" { + 1381 + } else if v == "1382" { + 1382 + } else if v == "1383" { + 1383 + } else if v == "1384" { + 1384 + } else if v == "1385" { + 1385 + } else if v == "1386" { + 1386 + } else if v == "1387" { + 1387 + } else if v == "1388" { + 1388 + } else if v == "1389" { + 1389 + } else if v == "1390" { + 1390 + } else if v == "1391" { + 1391 + } else if v == "1392" { + 1392 + } else if v == "1393" { + 1393 + } else if v == "1394" { + 1394 + } else if v == "1395" { + 1395 + } else if v == "1396" { + 1396 + } else if v == "1397" { + 1397 + } else if v == "1398" { + 1398 + } else if v == "1399" { + 1399 + } else if v == "1400" { + 1400 + } else if v == "1401" { + 1401 + } else if v == "1402" { + 1402 + } else if v == "1403" { + 1403 + } else if v == "1404" { + 1404 + } else if v == "1405" { + 1405 + } else if v == "1406" { + 1406 + } else if v == "1407" { + 1407 + } else if v == "1408" { + 1408 + } else if v == "1409" { + 1409 + } else if v == "1410" { + 1410 + } else if v == "1411" { + 1411 + } else if v == "1412" { + 1412 + } else if v == "1413" { + 1413 + } else if v == "1414" { + 1414 + } else if v == "1415" { + 1415 + } else if v == "1416" { + 1416 + } else if v == "1417" { + 1417 + } else if v == "1418" { + 1418 + } else if v == "1419" { + 1419 + } else if v == "1420" { + 1420 + } else if v == "1421" { + 1421 + } else if v == "1422" { + 1422 + } else if v == "1423" { + 1423 + } else if v == "1424" { + 1424 + } else if v == "1425" { + 1425 + } else if v == "1426" { + 1426 + } else if v == "1427" { + 1427 + } else if v == "1428" { + 1428 + } else if v == "1429" { + 1429 + } else if v == "1430" { + 1430 + } else if v == "1431" { + 1431 + } else if v == "1432" { + 1432 + } else if v == "1433" { + 1433 + } else if v == "1434" { + 1434 + } else if v == "1435" { + 1435 + } else if v == "1436" { + 1436 + } else if v == "1437" { + 1437 + } else if v == "1438" { + 1438 + } else if v == "1439" { + 1439 + } else if v == "1440" { + 1440 + } else if v == "1441" { + 1441 + } else if v == "1442" { + 1442 + } else if v == "1443" { + 1443 + } else if v == "1444" { + 1444 + } else if v == "1445" { + 1445 + } else if v == "1446" { + 1446 + } else if v == "1447" { + 1447 + } else if v == "1448" { + 1448 + } else if v == "1449" { + 1449 + } else if v == "1450" { + 1450 + } else if v == "1451" { + 1451 + } else if v == "1452" { + 1452 + } else if v == "1453" { + 1453 + } else if v == "1454" { + 1454 + } else if v == "1455" { + 1455 + } else if v == "1456" { + 1456 + } else if v == "1457" { + 1457 + } else if v == "1458" { + 1458 + } else if v == "1459" { + 1459 + } else if v == "1460" { + 1460 + } else if v == "1461" { + 1461 + } else if v == "1462" { + 1462 + } else if v == "1463" { + 1463 + } else if v == "1464" { + 1464 + } else if v == "1465" { + 1465 + } else if v == "1466" { + 1466 + } else if v == "1467" { + 1467 + } else if v == "1468" { + 1468 + } else if v == "1469" { + 1469 + } else if v == "1470" { + 1470 + } else if v == "1471" { + 1471 + } else if v == "1472" { + 1472 + } else if v == "1473" { + 1473 + } else if v == "1474" { + 1474 + } else if v == "1475" { + 1475 + } else if v == "1476" { + 1476 + } else if v == "1477" { + 1477 + } else if v == "1478" { + 1478 + } else if v == "1479" { + 1479 + } else if v == "1480" { + 1480 + } else if v == "1481" { + 1481 + } else if v == "1482" { + 1482 + } else if v == "1483" { + 1483 + } else if v == "1484" { + 1484 + } else if v == "1485" { + 1485 + } else if v == "1486" { + 1486 + } else if v == "1487" { + 1487 + } else if v == "1488" { + 1488 + } else if v == "1489" { + 1489 + } else if v == "1490" { + 1490 + } else if v == "1491" { + 1491 + } else if v == "1492" { + 1492 + } else if v == "1493" { + 1493 + } else if v == "1494" { + 1494 + } else if v == "1495" { + 1495 + } else if v == "1496" { + 1496 + } else if v == "1497" { + 1497 + } else if v == "1498" { + 1498 + } else if v == "1499" { + 1499 + } else if v == "1500" { + 1500 + } else if v == "1501" { + 1501 + } else if v == "1502" { + 1502 + } else if v == "1503" { + 1503 + } else if v == "1504" { + 1504 + } else if v == "1505" { + 1505 + } else if v == "1506" { + 1506 + } else if v == "1507" { + 1507 + } else if v == "1508" { + 1508 + } else if v == "1509" { + 1509 + } else if v == "1510" { + 1510 + } else if v == "1511" { + 1511 + } else if v == "1512" { + 1512 + } else if v == "1513" { + 1513 + } else if v == "1514" { + 1514 + } else if v == "1515" { + 1515 + } else if v == "1516" { + 1516 + } else if v == "1517" { + 1517 + } else if v == "1518" { + 1518 + } else if v == "1519" { + 1519 + } else if v == "1520" { + 1520 + } else if v == "1521" { + 1521 + } else if v == "1522" { + 1522 + } else if v == "1523" { + 1523 + } else if v == "1524" { + 1524 + } else if v == "1525" { + 1525 + } else if v == "1526" { + 1526 + } else if v == "1527" { + 1527 + } else if v == "1528" { + 1528 + } else if v == "1529" { + 1529 + } else if v == "1530" { + 1530 + } else if v == "1531" { + 1531 + } else if v == "1532" { + 1532 + } else if v == "1533" { + 1533 + } else if v == "1534" { + 1534 + } else if v == "1535" { + 1535 + } else if v == "1536" { + 1536 + } else if v == "1537" { + 1537 + } else if v == "1538" { + 1538 + } else if v == "1539" { + 1539 + } else if v == "1540" { + 1540 + } else if v == "1541" { + 1541 + } else if v == "1542" { + 1542 + } else if v == "1543" { + 1543 + } else if v == "1544" { + 1544 + } else if v == "1545" { + 1545 + } else if v == "1546" { + 1546 + } else if v == "1547" { + 1547 + } else if v == "1548" { + 1548 + } else if v == "1549" { + 1549 + } else if v == "1550" { + 1550 + } else if v == "1551" { + 1551 + } else if v == "1552" { + 1552 + } else if v == "1553" { + 1553 + } else if v == "1554" { + 1554 + } else if v == "1555" { + 1555 + } else if v == "1556" { + 1556 + } else if v == "1557" { + 1557 + } else if v == "1558" { + 1558 + } else if v == "1559" { + 1559 + } else if v == "1560" { + 1560 + } else if v == "1561" { + 1561 + } else if v == "1562" { + 1562 + } else if v == "1563" { + 1563 + } else if v == "1564" { + 1564 + } else if v == "1565" { + 1565 + } else if v == "1566" { + 1566 + } else if v == "1567" { + 1567 + } else if v == "1568" { + 1568 + } else if v == "1569" { + 1569 + } else if v == "1570" { + 1570 + } else if v == "1571" { + 1571 + } else if v == "1572" { + 1572 + } else if v == "1573" { + 1573 + } else if v == "1574" { + 1574 + } else if v == "1575" { + 1575 + } else if v == "1576" { + 1576 + } else if v == "1577" { + 1577 + } else if v == "1578" { + 1578 + } else if v == "1579" { + 1579 + } else if v == "1580" { + 1580 + } else if v == "1581" { + 1581 + } else if v == "1582" { + 1582 + } else if v == "1583" { + 1583 + } else if v == "1584" { + 1584 + } else if v == "1585" { + 1585 + } else if v == "1586" { + 1586 + } else if v == "1587" { + 1587 + } else if v == "1588" { + 1588 + } else if v == "1589" { + 1589 + } else if v == "1590" { + 1590 + } else if v == "1591" { + 1591 + } else if v == "1592" { + 1592 + } else if v == "1593" { + 1593 + } else if v == "1594" { + 1594 + } else if v == "1595" { + 1595 + } else if v == "1596" { + 1596 + } else if v == "1597" { + 1597 + } else if v == "1598" { + 1598 + } else if v == "1599" { + 1599 + } else if v == "1600" { + 1600 + } else if v == "1601" { + 1601 + } else if v == "1602" { + 1602 + } else if v == "1603" { + 1603 + } else if v == "1604" { + 1604 + } else if v == "1605" { + 1605 + } else if v == "1606" { + 1606 + } else if v == "1607" { + 1607 + } else if v == "1608" { + 1608 + } else if v == "1609" { + 1609 + } else if v == "1610" { + 1610 + } else if v == "1611" { + 1611 + } else if v == "1612" { + 1612 + } else if v == "1613" { + 1613 + } else if v == "1614" { + 1614 + } else if v == "1615" { + 1615 + } else if v == "1616" { + 1616 + } else if v == "1617" { + 1617 + } else if v == "1618" { + 1618 + } else if v == "1619" { + 1619 + } else if v == "1620" { + 1620 + } else if v == "1621" { + 1621 + } else if v == "1622" { + 1622 + } else if v == "1623" { + 1623 + } else if v == "1624" { + 1624 + } else if v == "1625" { + 1625 + } else if v == "1626" { + 1626 + } else if v == "1627" { + 1627 + } else if v == "1628" { + 1628 + } else if v == "1629" { + 1629 + } else if v == "1630" { + 1630 + } else if v == "1631" { + 1631 + } else if v == "1632" { + 1632 + } else if v == "1633" { + 1633 + } else if v == "1634" { + 1634 + } else if v == "1635" { + 1635 + } else if v == "1636" { + 1636 + } else if v == "1637" { + 1637 + } else if v == "1638" { + 1638 + } else if v == "1639" { + 1639 + } else if v == "1640" { + 1640 + } else if v == "1641" { + 1641 + } else if v == "1642" { + 1642 + } else if v == "1643" { + 1643 + } else if v == "1644" { + 1644 + } else if v == "1645" { + 1645 + } else if v == "1646" { + 1646 + } else if v == "1647" { + 1647 + } else if v == "1648" { + 1648 + } else if v == "1649" { + 1649 + } else if v == "1650" { + 1650 + } else if v == "1651" { + 1651 + } else if v == "1652" { + 1652 + } else if v == "1653" { + 1653 + } else if v == "1654" { + 1654 + } else if v == "1655" { + 1655 + } else if v == "1656" { + 1656 + } else if v == "1657" { + 1657 + } else if v == "1658" { + 1658 + } else if v == "1659" { + 1659 + } else if v == "1660" { + 1660 + } else if v == "1661" { + 1661 + } else if v == "1662" { + 1662 + } else if v == "1663" { + 1663 + } else if v == "1664" { + 1664 + } else if v == "1665" { + 1665 + } else if v == "1666" { + 1666 + } else if v == "1667" { + 1667 + } else if v == "1668" { + 1668 + } else if v == "1669" { + 1669 + } else if v == "1670" { + 1670 + } else if v == "1671" { + 1671 + } else if v == "1672" { + 1672 + } else if v == "1673" { + 1673 + } else if v == "1674" { + 1674 + } else if v == "1675" { + 1675 + } else if v == "1676" { + 1676 + } else if v == "1677" { + 1677 + } else if v == "1678" { + 1678 + } else if v == "1679" { + 1679 + } else if v == "1680" { + 1680 + } else if v == "1681" { + 1681 + } else if v == "1682" { + 1682 + } else if v == "1683" { + 1683 + } else if v == "1684" { + 1684 + } else if v == "1685" { + 1685 + } else if v == "1686" { + 1686 + } else if v == "1687" { + 1687 + } else if v == "1688" { + 1688 + } else if v == "1689" { + 1689 + } else if v == "1690" { + 1690 + } else if v == "1691" { + 1691 + } else if v == "1692" { + 1692 + } else if v == "1693" { + 1693 + } else if v == "1694" { + 1694 + } else if v == "1695" { + 1695 + } else if v == "1696" { + 1696 + } else if v == "1697" { + 1697 + } else if v == "1698" { + 1698 + } else if v == "1699" { + 1699 + } else if v == "1700" { + 1700 + } else if v == "1701" { + 1701 + } else if v == "1702" { + 1702 + } else if v == "1703" { + 1703 + } else if v == "1704" { + 1704 + } else if v == "1705" { + 1705 + } else if v == "1706" { + 1706 + } else if v == "1707" { + 1707 + } else if v == "1708" { + 1708 + } else if v == "1709" { + 1709 + } else if v == "1710" { + 1710 + } else if v == "1711" { + 1711 + } else if v == "1712" { + 1712 + } else if v == "1713" { + 1713 + } else if v == "1714" { + 1714 + } else if v == "1715" { + 1715 + } else if v == "1716" { + 1716 + } else if v == "1717" { + 1717 + } else if v == "1718" { + 1718 + } else if v == "1719" { + 1719 + } else if v == "1720" { + 1720 + } else if v == "1721" { + 1721 + } else if v == "1722" { + 1722 + } else if v == "1723" { + 1723 + } else if v == "1724" { + 1724 + } else if v == "1725" { + 1725 + } else if v == "1726" { + 1726 + } else if v == "1727" { + 1727 + } else if v == "1728" { + 1728 + } else if v == "1729" { + 1729 + } else if v == "1730" { + 1730 + } else if v == "1731" { + 1731 + } else if v == "1732" { + 1732 + } else if v == "1733" { + 1733 + } else if v == "1734" { + 1734 + } else if v == "1735" { + 1735 + } else if v == "1736" { + 1736 + } else if v == "1737" { + 1737 + } else if v == "1738" { + 1738 + } else if v == "1739" { + 1739 + } else if v == "1740" { + 1740 + } else if v == "1741" { + 1741 + } else if v == "1742" { + 1742 + } else if v == "1743" { + 1743 + } else if v == "1744" { + 1744 + } else if v == "1745" { + 1745 + } else if v == "1746" { + 1746 + } else if v == "1747" { + 1747 + } else if v == "1748" { + 1748 + } else if v == "1749" { + 1749 + } else if v == "1750" { + 1750 + } else if v == "1751" { + 1751 + } else if v == "1752" { + 1752 + } else if v == "1753" { + 1753 + } else if v == "1754" { + 1754 + } else if v == "1755" { + 1755 + } else if v == "1756" { + 1756 + } else if v == "1757" { + 1757 + } else if v == "1758" { + 1758 + } else if v == "1759" { + 1759 + } else if v == "1760" { + 1760 + } else if v == "1761" { + 1761 + } else if v == "1762" { + 1762 + } else if v == "1763" { + 1763 + } else if v == "1764" { + 1764 + } else if v == "1765" { + 1765 + } else if v == "1766" { + 1766 + } else if v == "1767" { + 1767 + } else if v == "1768" { + 1768 + } else if v == "1769" { + 1769 + } else if v == "1770" { + 1770 + } else if v == "1771" { + 1771 + } else if v == "1772" { + 1772 + } else if v == "1773" { + 1773 + } else if v == "1774" { + 1774 + } else if v == "1775" { + 1775 + } else if v == "1776" { + 1776 + } else if v == "1777" { + 1777 + } else if v == "1778" { + 1778 + } else if v == "1779" { + 1779 + } else if v == "1780" { + 1780 + } else if v == "1781" { + 1781 + } else if v == "1782" { + 1782 + } else if v == "1783" { + 1783 + } else if v == "1784" { + 1784 + } else if v == "1785" { + 1785 + } else if v == "1786" { + 1786 + } else if v == "1787" { + 1787 + } else if v == "1788" { + 1788 + } else if v == "1789" { + 1789 + } else if v == "1790" { + 1790 + } else if v == "1791" { + 1791 + } else if v == "1792" { + 1792 + } else if v == "1793" { + 1793 + } else if v == "1794" { + 1794 + } else if v == "1795" { + 1795 + } else if v == "1796" { + 1796 + } else if v == "1797" { + 1797 + } else if v == "1798" { + 1798 + } else if v == "1799" { + 1799 + } else if v == "1800" { + 1800 + } else if v == "1801" { + 1801 + } else if v == "1802" { + 1802 + } else if v == "1803" { + 1803 + } else if v == "1804" { + 1804 + } else if v == "1805" { + 1805 + } else if v == "1806" { + 1806 + } else if v == "1807" { + 1807 + } else if v == "1808" { + 1808 + } else if v == "1809" { + 1809 + } else if v == "1810" { + 1810 + } else if v == "1811" { + 1811 + } else if v == "1812" { + 1812 + } else if v == "1813" { + 1813 + } else if v == "1814" { + 1814 + } else if v == "1815" { + 1815 + } else if v == "1816" { + 1816 + } else if v == "1817" { + 1817 + } else if v == "1818" { + 1818 + } else if v == "1819" { + 1819 + } else if v == "1820" { + 1820 + } else if v == "1821" { + 1821 + } else if v == "1822" { + 1822 + } else if v == "1823" { + 1823 + } else if v == "1824" { + 1824 + } else if v == "1825" { + 1825 + } else if v == "1826" { + 1826 + } else if v == "1827" { + 1827 + } else if v == "1828" { + 1828 + } else if v == "1829" { + 1829 + } else if v == "1830" { + 1830 + } else if v == "1831" { + 1831 + } else if v == "1832" { + 1832 + } else if v == "1833" { + 1833 + } else if v == "1834" { + 1834 + } else if v == "1835" { + 1835 + } else if v == "1836" { + 1836 + } else if v == "1837" { + 1837 + } else if v == "1838" { + 1838 + } else if v == "1839" { + 1839 + } else if v == "1840" { + 1840 + } else if v == "1841" { + 1841 + } else if v == "1842" { + 1842 + } else if v == "1843" { + 1843 + } else if v == "1844" { + 1844 + } else if v == "1845" { + 1845 + } else if v == "1846" { + 1846 + } else if v == "1847" { + 1847 + } else if v == "1848" { + 1848 + } else if v == "1849" { + 1849 + } else if v == "1850" { + 1850 + } else if v == "1851" { + 1851 + } else if v == "1852" { + 1852 + } else if v == "1853" { + 1853 + } else if v == "1854" { + 1854 + } else if v == "1855" { + 1855 + } else if v == "1856" { + 1856 + } else if v == "1857" { + 1857 + } else if v == "1858" { + 1858 + } else if v == "1859" { + 1859 + } else if v == "1860" { + 1860 + } else if v == "1861" { + 1861 + } else if v == "1862" { + 1862 + } else if v == "1863" { + 1863 + } else if v == "1864" { + 1864 + } else if v == "1865" { + 1865 + } else if v == "1866" { + 1866 + } else if v == "1867" { + 1867 + } else if v == "1868" { + 1868 + } else if v == "1869" { + 1869 + } else if v == "1870" { + 1870 + } else if v == "1871" { + 1871 + } else if v == "1872" { + 1872 + } else if v == "1873" { + 1873 + } else if v == "1874" { + 1874 + } else if v == "1875" { + 1875 + } else if v == "1876" { + 1876 + } else if v == "1877" { + 1877 + } else if v == "1878" { + 1878 + } else if v == "1879" { + 1879 + } else if v == "1880" { + 1880 + } else if v == "1881" { + 1881 + } else if v == "1882" { + 1882 + } else if v == "1883" { + 1883 + } else if v == "1884" { + 1884 + } else if v == "1885" { + 1885 + } else if v == "1886" { + 1886 + } else if v == "1887" { + 1887 + } else if v == "1888" { + 1888 + } else if v == "1889" { + 1889 + } else if v == "1890" { + 1890 + } else if v == "1891" { + 1891 + } else if v == "1892" { + 1892 + } else if v == "1893" { + 1893 + } else if v == "1894" { + 1894 + } else if v == "1895" { + 1895 + } else if v == "1896" { + 1896 + } else if v == "1897" { + 1897 + } else if v == "1898" { + 1898 + } else if v == "1899" { + 1899 + } else if v == "1900" { + 1900 + } else if v == "1901" { + 1901 + } else if v == "1902" { + 1902 + } else if v == "1903" { + 1903 + } else if v == "1904" { + 1904 + } else if v == "1905" { + 1905 + } else if v == "1906" { + 1906 + } else if v == "1907" { + 1907 + } else if v == "1908" { + 1908 + } else if v == "1909" { + 1909 + } else if v == "1910" { + 1910 + } else if v == "1911" { + 1911 + } else if v == "1912" { + 1912 + } else if v == "1913" { + 1913 + } else if v == "1914" { + 1914 + } else if v == "1915" { + 1915 + } else if v == "1916" { + 1916 + } else if v == "1917" { + 1917 + } else if v == "1918" { + 1918 + } else if v == "1919" { + 1919 + } else if v == "1920" { + 1920 + } else if v == "1921" { + 1921 + } else if v == "1922" { + 1922 + } else if v == "1923" { + 1923 + } else if v == "1924" { + 1924 + } else if v == "1925" { + 1925 + } else if v == "1926" { + 1926 + } else if v == "1927" { + 1927 + } else if v == "1928" { + 1928 + } else if v == "1929" { + 1929 + } else if v == "1930" { + 1930 + } else if v == "1931" { + 1931 + } else if v == "1932" { + 1932 + } else if v == "1933" { + 1933 + } else if v == "1934" { + 1934 + } else if v == "1935" { + 1935 + } else if v == "1936" { + 1936 + } else if v == "1937" { + 1937 + } else if v == "1938" { + 1938 + } else if v == "1939" { + 1939 + } else if v == "1940" { + 1940 + } else if v == "1941" { + 1941 + } else if v == "1942" { + 1942 + } else if v == "1943" { + 1943 + } else if v == "1944" { + 1944 + } else if v == "1945" { + 1945 + } else if v == "1946" { + 1946 + } else if v == "1947" { + 1947 + } else if v == "1948" { + 1948 + } else if v == "1949" { + 1949 + } else if v == "1950" { + 1950 + } else if v == "1951" { + 1951 + } else if v == "1952" { + 1952 + } else if v == "1953" { + 1953 + } else if v == "1954" { + 1954 + } else if v == "1955" { + 1955 + } else if v == "1956" { + 1956 + } else if v == "1957" { + 1957 + } else if v == "1958" { + 1958 + } else if v == "1959" { + 1959 + } else if v == "1960" { + 1960 + } else if v == "1961" { + 1961 + } else if v == "1962" { + 1962 + } else if v == "1963" { + 1963 + } else if v == "1964" { + 1964 + } else if v == "1965" { + 1965 + } else if v == "1966" { + 1966 + } else if v == "1967" { + 1967 + } else if v == "1968" { + 1968 + } else if v == "1969" { + 1969 + } else if v == "1970" { + 1970 + } else if v == "1971" { + 1971 + } else if v == "1972" { + 1972 + } else if v == "1973" { + 1973 + } else if v == "1974" { + 1974 + } else if v == "1975" { + 1975 + } else if v == "1976" { + 1976 + } else if v == "1977" { + 1977 + } else if v == "1978" { + 1978 + } else if v == "1979" { + 1979 + } else if v == "1980" { + 1980 + } else if v == "1981" { + 1981 + } else if v == "1982" { + 1982 + } else if v == "1983" { + 1983 + } else if v == "1984" { + 1984 + } else if v == "1985" { + 1985 + } else if v == "1986" { + 1986 + } else if v == "1987" { + 1987 + } else if v == "1988" { + 1988 + } else if v == "1989" { + 1989 + } else if v == "1990" { + 1990 + } else if v == "1991" { + 1991 + } else if v == "1992" { + 1992 + } else if v == "1993" { + 1993 + } else if v == "1994" { + 1994 + } else if v == "1995" { + 1995 + } else if v == "1996" { + 1996 + } else if v == "1997" { + 1997 + } else if v == "1998" { + 1998 + } else if v == "1999" { + 1999 + } else if v == "2000" { + 2000 + } else if v == "2001" { + 2001 + } else if v == "2002" { + 2002 + } else if v == "2003" { + 2003 + } else if v == "2004" { + 2004 + } else if v == "2005" { + 2005 + } else if v == "2006" { + 2006 + } else if v == "2007" { + 2007 + } else if v == "2008" { + 2008 + } else if v == "2009" { + 2009 + } else if v == "2010" { + 2010 + } else if v == "2011" { + 2011 + } else if v == "2012" { + 2012 + } else if v == "2013" { + 2013 + } else if v == "2014" { + 2014 + } else if v == "2015" { + 2015 + } else if v == "2016" { + 2016 + } else if v == "2017" { + 2017 + } else if v == "2018" { + 2018 + } else if v == "2019" { + 2019 + } else if v == "2020" { + 2020 + } else if v == "2021" { + 2021 + } else if v == "2022" { + 2022 + } else if v == "2023" { + 2023 + } else if v == "2024" { + 2024 + } else if v == "2025" { + 2025 + } else if v == "2026" { + 2026 + } else if v == "2027" { + 2027 + } else if v == "2028" { + 2028 + } else if v == "2029" { + 2029 + } else if v == "2030" { + 2030 + } else if v == "2031" { + 2031 + } else if v == "2032" { + 2032 + } else if v == "2033" { + 2033 + } else if v == "2034" { + 2034 + } else if v == "2035" { + 2035 + } else if v == "2036" { + 2036 + } else if v == "2037" { + 2037 + } else if v == "2038" { + 2038 + } else if v == "2039" { + 2039 + } else if v == "2040" { + 2040 + } else if v == "2041" { + 2041 + } else if v == "2042" { + 2042 + } else if v == "2043" { + 2043 + } else if v == "2044" { + 2044 + } else if v == "2045" { + 2045 + } else if v == "2046" { + 2046 + } else if v == "2047" { + 2047 + } else if v == "2048" { + 2048 + } else if v == "2049" { + 2049 + } else if v == "2050" { + 2050 + } else if v == "2051" { + 2051 + } else if v == "2052" { + 2052 + } else if v == "2053" { + 2053 + } else if v == "2054" { + 2054 + } else if v == "2055" { + 2055 + } else if v == "2056" { + 2056 + } else if v == "2057" { + 2057 + } else if v == "2058" { + 2058 + } else if v == "2059" { + 2059 + } else if v == "2060" { + 2060 + } else if v == "2061" { + 2061 + } else if v == "2062" { + 2062 + } else if v == "2063" { + 2063 + } else if v == "2064" { + 2064 + } else if v == "2065" { + 2065 + } else if v == "2066" { + 2066 + } else if v == "2067" { + 2067 + } else if v == "2068" { + 2068 + } else if v == "2069" { + 2069 + } else if v == "2070" { + 2070 + } else if v == "2071" { + 2071 + } else if v == "2072" { + 2072 + } else if v == "2073" { + 2073 + } else if v == "2074" { + 2074 + } else if v == "2075" { + 2075 + } else if v == "2076" { + 2076 + } else if v == "2077" { + 2077 + } else if v == "2078" { + 2078 + } else if v == "2079" { + 2079 + } else if v == "2080" { + 2080 + } else if v == "2081" { + 2081 + } else if v == "2082" { + 2082 + } else if v == "2083" { + 2083 + } else if v == "2084" { + 2084 + } else if v == "2085" { + 2085 + } else if v == "2086" { + 2086 + } else if v == "2087" { + 2087 + } else if v == "2088" { + 2088 + } else if v == "2089" { + 2089 + } else if v == "2090" { + 2090 + } else if v == "2091" { + 2091 + } else if v == "2092" { + 2092 + } else if v == "2093" { + 2093 + } else if v == "2094" { + 2094 + } else if v == "2095" { + 2095 + } else if v == "2096" { + 2096 + } else if v == "2097" { + 2097 + } else if v == "2098" { + 2098 + } else if v == "2099" { + 2099 + } else if v == "2100" { + 2100 + } else if v == "2101" { + 2101 + } else if v == "2102" { + 2102 + } else if v == "2103" { + 2103 + } else if v == "2104" { + 2104 + } else if v == "2105" { + 2105 + } else if v == "2106" { + 2106 + } else if v == "2107" { + 2107 + } else if v == "2108" { + 2108 + } else if v == "2109" { + 2109 + } else if v == "2110" { + 2110 + } else if v == "2111" { + 2111 + } else if v == "2112" { + 2112 + } else if v == "2113" { + 2113 + } else if v == "2114" { + 2114 + } else if v == "2115" { + 2115 + } else if v == "2116" { + 2116 + } else if v == "2117" { + 2117 + } else if v == "2118" { + 2118 + } else if v == "2119" { + 2119 + } else if v == "2120" { + 2120 + } else if v == "2121" { + 2121 + } else if v == "2122" { + 2122 + } else if v == "2123" { + 2123 + } else if v == "2124" { + 2124 + } else if v == "2125" { + 2125 + } else if v == "2126" { + 2126 + } else if v == "2127" { + 2127 + } else if v == "2128" { + 2128 + } else if v == "2129" { + 2129 + } else if v == "2130" { + 2130 + } else if v == "2131" { + 2131 + } else if v == "2132" { + 2132 + } else if v == "2133" { + 2133 + } else if v == "2134" { + 2134 + } else if v == "2135" { + 2135 + } else if v == "2136" { + 2136 + } else if v == "2137" { + 2137 + } else if v == "2138" { + 2138 + } else if v == "2139" { + 2139 + } else if v == "2140" { + 2140 + } else if v == "2141" { + 2141 + } else if v == "2142" { + 2142 + } else if v == "2143" { + 2143 + } else if v == "2144" { + 2144 + } else if v == "2145" { + 2145 + } else if v == "2146" { + 2146 + } else if v == "2147" { + 2147 + } else if v == "2148" { + 2148 + } else if v == "2149" { + 2149 + } else if v == "2150" { + 2150 + } else if v == "2151" { + 2151 + } else if v == "2152" { + 2152 + } else if v == "2153" { + 2153 + } else if v == "2154" { + 2154 + } else if v == "2155" { + 2155 + } else if v == "2156" { + 2156 + } else if v == "2157" { + 2157 + } else if v == "2158" { + 2158 + } else if v == "2159" { + 2159 + } else if v == "2160" { + 2160 + } else if v == "2161" { + 2161 + } else if v == "2162" { + 2162 + } else if v == "2163" { + 2163 + } else if v == "2164" { + 2164 + } else if v == "2165" { + 2165 + } else if v == "2166" { + 2166 + } else if v == "2167" { + 2167 + } else if v == "2168" { + 2168 + } else if v == "2169" { + 2169 + } else if v == "2170" { + 2170 + } else if v == "2171" { + 2171 + } else if v == "2172" { + 2172 + } else if v == "2173" { + 2173 + } else if v == "2174" { + 2174 + } else if v == "2175" { + 2175 + } else if v == "2176" { + 2176 + } else if v == "2177" { + 2177 + } else if v == "2178" { + 2178 + } else if v == "2179" { + 2179 + } else if v == "2180" { + 2180 + } else if v == "2181" { + 2181 + } else if v == "2182" { + 2182 + } else if v == "2183" { + 2183 + } else if v == "2184" { + 2184 + } else if v == "2185" { + 2185 + } else if v == "2186" { + 2186 + } else if v == "2187" { + 2187 + } else if v == "2188" { + 2188 + } else if v == "2189" { + 2189 + } else if v == "2190" { + 2190 + } else if v == "2191" { + 2191 + } else if v == "2192" { + 2192 + } else if v == "2193" { + 2193 + } else if v == "2194" { + 2194 + } else if v == "2195" { + 2195 + } else if v == "2196" { + 2196 + } else if v == "2197" { + 2197 + } else if v == "2198" { + 2198 + } else if v == "2199" { + 2199 + } else if v == "2200" { + 2200 + } else if v == "2201" { + 2201 + } else if v == "2202" { + 2202 + } else if v == "2203" { + 2203 + } else if v == "2204" { + 2204 + } else if v == "2205" { + 2205 + } else if v == "2206" { + 2206 + } else if v == "2207" { + 2207 + } else if v == "2208" { + 2208 + } else if v == "2209" { + 2209 + } else if v == "2210" { + 2210 + } else if v == "2211" { + 2211 + } else if v == "2212" { + 2212 + } else if v == "2213" { + 2213 + } else if v == "2214" { + 2214 + } else if v == "2215" { + 2215 + } else if v == "2216" { + 2216 + } else if v == "2217" { + 2217 + } else if v == "2218" { + 2218 + } else if v == "2219" { + 2219 + } else if v == "2220" { + 2220 + } else if v == "2221" { + 2221 + } else if v == "2222" { + 2222 + } else if v == "2223" { + 2223 + } else if v == "2224" { + 2224 + } else if v == "2225" { + 2225 + } else if v == "2226" { + 2226 + } else if v == "2227" { + 2227 + } else if v == "2228" { + 2228 + } else if v == "2229" { + 2229 + } else if v == "2230" { + 2230 + } else if v == "2231" { + 2231 + } else if v == "2232" { + 2232 + } else if v == "2233" { + 2233 + } else if v == "2234" { + 2234 + } else if v == "2235" { + 2235 + } else if v == "2236" { + 2236 + } else if v == "2237" { + 2237 + } else if v == "2238" { + 2238 + } else if v == "2239" { + 2239 + } else if v == "2240" { + 2240 + } else if v == "2241" { + 2241 + } else if v == "2242" { + 2242 + } else if v == "2243" { + 2243 + } else if v == "2244" { + 2244 + } else if v == "2245" { + 2245 + } else if v == "2246" { + 2246 + } else if v == "2247" { + 2247 + } else if v == "2248" { + 2248 + } else if v == "2249" { + 2249 + } else if v == "2250" { + 2250 + } else if v == "2251" { + 2251 + } else if v == "2252" { + 2252 + } else if v == "2253" { + 2253 + } else if v == "2254" { + 2254 + } else if v == "2255" { + 2255 + } else if v == "2256" { + 2256 + } else if v == "2257" { + 2257 + } else if v == "2258" { + 2258 + } else if v == "2259" { + 2259 + } else if v == "2260" { + 2260 + } else if v == "2261" { + 2261 + } else if v == "2262" { + 2262 + } else if v == "2263" { + 2263 + } else if v == "2264" { + 2264 + } else if v == "2265" { + 2265 + } else if v == "2266" { + 2266 + } else if v == "2267" { + 2267 + } else if v == "2268" { + 2268 + } else if v == "2269" { + 2269 + } else if v == "2270" { + 2270 + } else if v == "2271" { + 2271 + } else if v == "2272" { + 2272 + } else if v == "2273" { + 2273 + } else if v == "2274" { + 2274 + } else if v == "2275" { + 2275 + } else if v == "2276" { + 2276 + } else if v == "2277" { + 2277 + } else if v == "2278" { + 2278 + } else if v == "2279" { + 2279 + } else if v == "2280" { + 2280 + } else if v == "2281" { + 2281 + } else if v == "2282" { + 2282 + } else if v == "2283" { + 2283 + } else if v == "2284" { + 2284 + } else if v == "2285" { + 2285 + } else if v == "2286" { + 2286 + } else if v == "2287" { + 2287 + } else if v == "2288" { + 2288 + } else if v == "2289" { + 2289 + } else if v == "2290" { + 2290 + } else if v == "2291" { + 2291 + } else if v == "2292" { + 2292 + } else if v == "2293" { + 2293 + } else if v == "2294" { + 2294 + } else if v == "2295" { + 2295 + } else if v == "2296" { + 2296 + } else if v == "2297" { + 2297 + } else if v == "2298" { + 2298 + } else if v == "2299" { + 2299 + } else if v == "2300" { + 2300 + } else if v == "2301" { + 2301 + } else if v == "2302" { + 2302 + } else if v == "2303" { + 2303 + } else if v == "2304" { + 2304 + } else if v == "2305" { + 2305 + } else if v == "2306" { + 2306 + } else if v == "2307" { + 2307 + } else if v == "2308" { + 2308 + } else if v == "2309" { + 2309 + } else if v == "2310" { + 2310 + } else if v == "2311" { + 2311 + } else if v == "2312" { + 2312 + } else if v == "2313" { + 2313 + } else if v == "2314" { + 2314 + } else if v == "2315" { + 2315 + } else if v == "2316" { + 2316 + } else if v == "2317" { + 2317 + } else if v == "2318" { + 2318 + } else if v == "2319" { + 2319 + } else if v == "2320" { + 2320 + } else if v == "2321" { + 2321 + } else if v == "2322" { + 2322 + } else if v == "2323" { + 2323 + } else if v == "2324" { + 2324 + } else if v == "2325" { + 2325 + } else if v == "2326" { + 2326 + } else if v == "2327" { + 2327 + } else if v == "2328" { + 2328 + } else if v == "2329" { + 2329 + } else if v == "2330" { + 2330 + } else if v == "2331" { + 2331 + } else if v == "2332" { + 2332 + } else if v == "2333" { + 2333 + } else if v == "2334" { + 2334 + } else if v == "2335" { + 2335 + } else if v == "2336" { + 2336 + } else if v == "2337" { + 2337 + } else if v == "2338" { + 2338 + } else if v == "2339" { + 2339 + } else if v == "2340" { + 2340 + } else if v == "2341" { + 2341 + } else if v == "2342" { + 2342 + } else if v == "2343" { + 2343 + } else if v == "2344" { + 2344 + } else if v == "2345" { + 2345 + } else if v == "2346" { + 2346 + } else if v == "2347" { + 2347 + } else if v == "2348" { + 2348 + } else if v == "2349" { + 2349 + } else if v == "2350" { + 2350 + } else if v == "2351" { + 2351 + } else if v == "2352" { + 2352 + } else if v == "2353" { + 2353 + } else if v == "2354" { + 2354 + } else if v == "2355" { + 2355 + } else if v == "2356" { + 2356 + } else if v == "2357" { + 2357 + } else if v == "2358" { + 2358 + } else if v == "2359" { + 2359 + } else if v == "2360" { + 2360 + } else if v == "2361" { + 2361 + } else if v == "2362" { + 2362 + } else if v == "2363" { + 2363 + } else if v == "2364" { + 2364 + } else if v == "2365" { + 2365 + } else if v == "2366" { + 2366 + } else if v == "2367" { + 2367 + } else if v == "2368" { + 2368 + } else if v == "2369" { + 2369 + } else if v == "2370" { + 2370 + } else if v == "2371" { + 2371 + } else if v == "2372" { + 2372 + } else if v == "2373" { + 2373 + } else if v == "2374" { + 2374 + } else if v == "2375" { + 2375 + } else if v == "2376" { + 2376 + } else if v == "2377" { + 2377 + } else if v == "2378" { + 2378 + } else if v == "2379" { + 2379 + } else if v == "2380" { + 2380 + } else if v == "2381" { + 2381 + } else if v == "2382" { + 2382 + } else if v == "2383" { + 2383 + } else if v == "2384" { + 2384 + } else if v == "2385" { + 2385 + } else if v == "2386" { + 2386 + } else if v == "2387" { + 2387 + } else if v == "2388" { + 2388 + } else if v == "2389" { + 2389 + } else if v == "2390" { + 2390 + } else if v == "2391" { + 2391 + } else if v == "2392" { + 2392 + } else if v == "2393" { + 2393 + } else if v == "2394" { + 2394 + } else if v == "2395" { + 2395 + } else if v == "2396" { + 2396 + } else if v == "2397" { + 2397 + } else if v == "2398" { + 2398 + } else if v == "2399" { + 2399 + } else if v == "2400" { + 2400 + } else if v == "2401" { + 2401 + } else if v == "2402" { + 2402 + } else if v == "2403" { + 2403 + } else if v == "2404" { + 2404 + } else if v == "2405" { + 2405 + } else if v == "2406" { + 2406 + } else if v == "2407" { + 2407 + } else if v == "2408" { + 2408 + } else if v == "2409" { + 2409 + } else if v == "2410" { + 2410 + } else if v == "2411" { + 2411 + } else if v == "2412" { + 2412 + } else if v == "2413" { + 2413 + } else if v == "2414" { + 2414 + } else if v == "2415" { + 2415 + } else if v == "2416" { + 2416 + } else if v == "2417" { + 2417 + } else if v == "2418" { + 2418 + } else if v == "2419" { + 2419 + } else if v == "2420" { + 2420 + } else if v == "2421" { + 2421 + } else if v == "2422" { + 2422 + } else if v == "2423" { + 2423 + } else if v == "2424" { + 2424 + } else if v == "2425" { + 2425 + } else if v == "2426" { + 2426 + } else if v == "2427" { + 2427 + } else if v == "2428" { + 2428 + } else if v == "2429" { + 2429 + } else if v == "2430" { + 2430 + } else if v == "2431" { + 2431 + } else if v == "2432" { + 2432 + } else if v == "2433" { + 2433 + } else if v == "2434" { + 2434 + } else if v == "2435" { + 2435 + } else if v == "2436" { + 2436 + } else if v == "2437" { + 2437 + } else if v == "2438" { + 2438 + } else if v == "2439" { + 2439 + } else if v == "2440" { + 2440 + } else if v == "2441" { + 2441 + } else if v == "2442" { + 2442 + } else if v == "2443" { + 2443 + } else if v == "2444" { + 2444 + } else if v == "2445" { + 2445 + } else if v == "2446" { + 2446 + } else if v == "2447" { + 2447 + } else if v == "2448" { + 2448 + } else if v == "2449" { + 2449 + } else if v == "2450" { + 2450 + } else if v == "2451" { + 2451 + } else if v == "2452" { + 2452 + } else if v == "2453" { + 2453 + } else if v == "2454" { + 2454 + } else if v == "2455" { + 2455 + } else if v == "2456" { + 2456 + } else if v == "2457" { + 2457 + } else if v == "2458" { + 2458 + } else if v == "2459" { + 2459 + } else if v == "2460" { + 2460 + } else if v == "2461" { + 2461 + } else if v == "2462" { + 2462 + } else if v == "2463" { + 2463 + } else if v == "2464" { + 2464 + } else if v == "2465" { + 2465 + } else if v == "2466" { + 2466 + } else if v == "2467" { + 2467 + } else if v == "2468" { + 2468 + } else if v == "2469" { + 2469 + } else if v == "2470" { + 2470 + } else if v == "2471" { + 2471 + } else if v == "2472" { + 2472 + } else if v == "2473" { + 2473 + } else if v == "2474" { + 2474 + } else if v == "2475" { + 2475 + } else if v == "2476" { + 2476 + } else if v == "2477" { + 2477 + } else if v == "2478" { + 2478 + } else if v == "2479" { + 2479 + } else if v == "2480" { + 2480 + } else if v == "2481" { + 2481 + } else if v == "2482" { + 2482 + } else if v == "2483" { + 2483 + } else if v == "2484" { + 2484 + } else if v == "2485" { + 2485 + } else if v == "2486" { + 2486 + } else if v == "2487" { + 2487 + } else if v == "2488" { + 2488 + } else if v == "2489" { + 2489 + } else if v == "2490" { + 2490 + } else if v == "2491" { + 2491 + } else if v == "2492" { + 2492 + } else if v == "2493" { + 2493 + } else if v == "2494" { + 2494 + } else if v == "2495" { + 2495 + } else if v == "2496" { + 2496 + } else if v == "2497" { + 2497 + } else if v == "2498" { + 2498 + } else if v == "2499" { + 2499 + } else if v == "2500" { + 2500 + } else if v == "2501" { + 2501 + } else if v == "2502" { + 2502 + } else if v == "2503" { + 2503 + } else if v == "2504" { + 2504 + } else if v == "2505" { + 2505 + } else if v == "2506" { + 2506 + } else if v == "2507" { + 2507 + } else if v == "2508" { + 2508 + } else if v == "2509" { + 2509 + } else if v == "2510" { + 2510 + } else if v == "2511" { + 2511 + } else if v == "2512" { + 2512 + } else if v == "2513" { + 2513 + } else if v == "2514" { + 2514 + } else if v == "2515" { + 2515 + } else if v == "2516" { + 2516 + } else if v == "2517" { + 2517 + } else if v == "2518" { + 2518 + } else if v == "2519" { + 2519 + } else if v == "2520" { + 2520 + } else if v == "2521" { + 2521 + } else if v == "2522" { + 2522 + } else if v == "2523" { + 2523 + } else if v == "2524" { + 2524 + } else if v == "2525" { + 2525 + } else if v == "2526" { + 2526 + } else if v == "2527" { + 2527 + } else if v == "2528" { + 2528 + } else if v == "2529" { + 2529 + } else if v == "2530" { + 2530 + } else if v == "2531" { + 2531 + } else if v == "2532" { + 2532 + } else if v == "2533" { + 2533 + } else if v == "2534" { + 2534 + } else if v == "2535" { + 2535 + } else if v == "2536" { + 2536 + } else if v == "2537" { + 2537 + } else if v == "2538" { + 2538 + } else if v == "2539" { + 2539 + } else if v == "2540" { + 2540 + } else if v == "2541" { + 2541 + } else if v == "2542" { + 2542 + } else if v == "2543" { + 2543 + } else if v == "2544" { + 2544 + } else if v == "2545" { + 2545 + } else if v == "2546" { + 2546 + } else if v == "2547" { + 2547 + } else if v == "2548" { + 2548 + } else if v == "2549" { + 2549 + } else if v == "2550" { + 2550 + } else if v == "2551" { + 2551 + } else if v == "2552" { + 2552 + } else if v == "2553" { + 2553 + } else if v == "2554" { + 2554 + } else if v == "2555" { + 2555 + } else if v == "2556" { + 2556 + } else if v == "2557" { + 2557 + } else if v == "2558" { + 2558 + } else if v == "2559" { + 2559 + } else if v == "2560" { + 2560 + } else if v == "2561" { + 2561 + } else if v == "2562" { + 2562 + } else if v == "2563" { + 2563 + } else if v == "2564" { + 2564 + } else if v == "2565" { + 2565 + } else if v == "2566" { + 2566 + } else if v == "2567" { + 2567 + } else if v == "2568" { + 2568 + } else if v == "2569" { + 2569 + } else if v == "2570" { + 2570 + } else if v == "2571" { + 2571 + } else if v == "2572" { + 2572 + } else if v == "2573" { + 2573 + } else if v == "2574" { + 2574 + } else if v == "2575" { + 2575 + } else if v == "2576" { + 2576 + } else if v == "2577" { + 2577 + } else if v == "2578" { + 2578 + } else if v == "2579" { + 2579 + } else if v == "2580" { + 2580 + } else if v == "2581" { + 2581 + } else if v == "2582" { + 2582 + } else if v == "2583" { + 2583 + } else if v == "2584" { + 2584 + } else if v == "2585" { + 2585 + } else if v == "2586" { + 2586 + } else if v == "2587" { + 2587 + } else if v == "2588" { + 2588 + } else if v == "2589" { + 2589 + } else if v == "2590" { + 2590 + } else if v == "2591" { + 2591 + } else if v == "2592" { + 2592 + } else if v == "2593" { + 2593 + } else if v == "2594" { + 2594 + } else if v == "2595" { + 2595 + } else if v == "2596" { + 2596 + } else if v == "2597" { + 2597 + } else if v == "2598" { + 2598 + } else if v == "2599" { + 2599 + } else if v == "2600" { + 2600 + } else if v == "2601" { + 2601 + } else if v == "2602" { + 2602 + } else if v == "2603" { + 2603 + } else if v == "2604" { + 2604 + } else if v == "2605" { + 2605 + } else if v == "2606" { + 2606 + } else if v == "2607" { + 2607 + } else if v == "2608" { + 2608 + } else if v == "2609" { + 2609 + } else if v == "2610" { + 2610 + } else if v == "2611" { + 2611 + } else if v == "2612" { + 2612 + } else if v == "2613" { + 2613 + } else if v == "2614" { + 2614 + } else if v == "2615" { + 2615 + } else if v == "2616" { + 2616 + } else if v == "2617" { + 2617 + } else if v == "2618" { + 2618 + } else if v == "2619" { + 2619 + } else if v == "2620" { + 2620 + } else if v == "2621" { + 2621 + } else if v == "2622" { + 2622 + } else if v == "2623" { + 2623 + } else if v == "2624" { + 2624 + } else if v == "2625" { + 2625 + } else if v == "2626" { + 2626 + } else if v == "2627" { + 2627 + } else if v == "2628" { + 2628 + } else if v == "2629" { + 2629 + } else if v == "2630" { + 2630 + } else if v == "2631" { + 2631 + } else if v == "2632" { + 2632 + } else if v == "2633" { + 2633 + } else if v == "2634" { + 2634 + } else if v == "2635" { + 2635 + } else if v == "2636" { + 2636 + } else if v == "2637" { + 2637 + } else if v == "2638" { + 2638 + } else if v == "2639" { + 2639 + } else if v == "2640" { + 2640 + } else if v == "2641" { + 2641 + } else if v == "2642" { + 2642 + } else if v == "2643" { + 2643 + } else if v == "2644" { + 2644 + } else if v == "2645" { + 2645 + } else if v == "2646" { + 2646 + } else if v == "2647" { + 2647 + } else if v == "2648" { + 2648 + } else if v == "2649" { + 2649 + } else if v == "2650" { + 2650 + } else if v == "2651" { + 2651 + } else if v == "2652" { + 2652 + } else if v == "2653" { + 2653 + } else if v == "2654" { + 2654 + } else if v == "2655" { + 2655 + } else if v == "2656" { + 2656 + } else if v == "2657" { + 2657 + } else if v == "2658" { + 2658 + } else if v == "2659" { + 2659 + } else if v == "2660" { + 2660 + } else if v == "2661" { + 2661 + } else if v == "2662" { + 2662 + } else if v == "2663" { + 2663 + } else if v == "2664" { + 2664 + } else if v == "2665" { + 2665 + } else if v == "2666" { + 2666 + } else if v == "2667" { + 2667 + } else if v == "2668" { + 2668 + } else if v == "2669" { + 2669 + } else if v == "2670" { + 2670 + } else if v == "2671" { + 2671 + } else if v == "2672" { + 2672 + } else if v == "2673" { + 2673 + } else if v == "2674" { + 2674 + } else if v == "2675" { + 2675 + } else if v == "2676" { + 2676 + } else if v == "2677" { + 2677 + } else if v == "2678" { + 2678 + } else if v == "2679" { + 2679 + } else if v == "2680" { + 2680 + } else if v == "2681" { + 2681 + } else if v == "2682" { + 2682 + } else if v == "2683" { + 2683 + } else if v == "2684" { + 2684 + } else if v == "2685" { + 2685 + } else if v == "2686" { + 2686 + } else if v == "2687" { + 2687 + } else if v == "2688" { + 2688 + } else if v == "2689" { + 2689 + } else if v == "2690" { + 2690 + } else if v == "2691" { + 2691 + } else if v == "2692" { + 2692 + } else if v == "2693" { + 2693 + } else if v == "2694" { + 2694 + } else if v == "2695" { + 2695 + } else if v == "2696" { + 2696 + } else if v == "2697" { + 2697 + } else if v == "2698" { + 2698 + } else if v == "2699" { + 2699 + } else if v == "2700" { + 2700 + } else if v == "2701" { + 2701 + } else if v == "2702" { + 2702 + } else if v == "2703" { + 2703 + } else if v == "2704" { + 2704 + } else if v == "2705" { + 2705 + } else if v == "2706" { + 2706 + } else if v == "2707" { + 2707 + } else if v == "2708" { + 2708 + } else if v == "2709" { + 2709 + } else if v == "2710" { + 2710 + } else if v == "2711" { + 2711 + } else if v == "2712" { + 2712 + } else if v == "2713" { + 2713 + } else if v == "2714" { + 2714 + } else if v == "2715" { + 2715 + } else if v == "2716" { + 2716 + } else if v == "2717" { + 2717 + } else if v == "2718" { + 2718 + } else if v == "2719" { + 2719 + } else if v == "2720" { + 2720 + } else if v == "2721" { + 2721 + } else if v == "2722" { + 2722 + } else if v == "2723" { + 2723 + } else if v == "2724" { + 2724 + } else if v == "2725" { + 2725 + } else if v == "2726" { + 2726 + } else if v == "2727" { + 2727 + } else if v == "2728" { + 2728 + } else if v == "2729" { + 2729 + } else if v == "2730" { + 2730 + } else if v == "2731" { + 2731 + } else if v == "2732" { + 2732 + } else if v == "2733" { + 2733 + } else if v == "2734" { + 2734 + } else if v == "2735" { + 2735 + } else if v == "2736" { + 2736 + } else if v == "2737" { + 2737 + } else if v == "2738" { + 2738 + } else if v == "2739" { + 2739 + } else if v == "2740" { + 2740 + } else if v == "2741" { + 2741 + } else if v == "2742" { + 2742 + } else if v == "2743" { + 2743 + } else if v == "2744" { + 2744 + } else if v == "2745" { + 2745 + } else if v == "2746" { + 2746 + } else if v == "2747" { + 2747 + } else if v == "2748" { + 2748 + } else if v == "2749" { + 2749 + } else if v == "2750" { + 2750 + } else if v == "2751" { + 2751 + } else if v == "2752" { + 2752 + } else if v == "2753" { + 2753 + } else if v == "2754" { + 2754 + } else if v == "2755" { + 2755 + } else if v == "2756" { + 2756 + } else if v == "2757" { + 2757 + } else if v == "2758" { + 2758 + } else if v == "2759" { + 2759 + } else if v == "2760" { + 2760 + } else if v == "2761" { + 2761 + } else if v == "2762" { + 2762 + } else if v == "2763" { + 2763 + } else if v == "2764" { + 2764 + } else if v == "2765" { + 2765 + } else if v == "2766" { + 2766 + } else if v == "2767" { + 2767 + } else if v == "2768" { + 2768 + } else if v == "2769" { + 2769 + } else if v == "2770" { + 2770 + } else if v == "2771" { + 2771 + } else if v == "2772" { + 2772 + } else if v == "2773" { + 2773 + } else if v == "2774" { + 2774 + } else if v == "2775" { + 2775 + } else if v == "2776" { + 2776 + } else if v == "2777" { + 2777 + } else if v == "2778" { + 2778 + } else if v == "2779" { + 2779 + } else if v == "2780" { + 2780 + } else if v == "2781" { + 2781 + } else if v == "2782" { + 2782 + } else if v == "2783" { + 2783 + } else if v == "2784" { + 2784 + } else if v == "2785" { + 2785 + } else if v == "2786" { + 2786 + } else if v == "2787" { + 2787 + } else if v == "2788" { + 2788 + } else if v == "2789" { + 2789 + } else if v == "2790" { + 2790 + } else if v == "2791" { + 2791 + } else if v == "2792" { + 2792 + } else if v == "2793" { + 2793 + } else if v == "2794" { + 2794 + } else if v == "2795" { + 2795 + } else if v == "2796" { + 2796 + } else if v == "2797" { + 2797 + } else if v == "2798" { + 2798 + } else if v == "2799" { + 2799 + } else if v == "2800" { + 2800 + } else if v == "2801" { + 2801 + } else if v == "2802" { + 2802 + } else if v == "2803" { + 2803 + } else if v == "2804" { + 2804 + } else if v == "2805" { + 2805 + } else if v == "2806" { + 2806 + } else if v == "2807" { + 2807 + } else if v == "2808" { + 2808 + } else if v == "2809" { + 2809 + } else if v == "2810" { + 2810 + } else if v == "2811" { + 2811 + } else if v == "2812" { + 2812 + } else if v == "2813" { + 2813 + } else if v == "2814" { + 2814 + } else if v == "2815" { + 2815 + } else if v == "2816" { + 2816 + } else if v == "2817" { + 2817 + } else if v == "2818" { + 2818 + } else if v == "2819" { + 2819 + } else if v == "2820" { + 2820 + } else if v == "2821" { + 2821 + } else if v == "2822" { + 2822 + } else if v == "2823" { + 2823 + } else if v == "2824" { + 2824 + } else if v == "2825" { + 2825 + } else if v == "2826" { + 2826 + } else if v == "2827" { + 2827 + } else if v == "2828" { + 2828 + } else if v == "2829" { + 2829 + } else if v == "2830" { + 2830 + } else if v == "2831" { + 2831 + } else if v == "2832" { + 2832 + } else if v == "2833" { + 2833 + } else if v == "2834" { + 2834 + } else if v == "2835" { + 2835 + } else if v == "2836" { + 2836 + } else if v == "2837" { + 2837 + } else if v == "2838" { + 2838 + } else if v == "2839" { + 2839 + } else if v == "2840" { + 2840 + } else if v == "2841" { + 2841 + } else if v == "2842" { + 2842 + } else if v == "2843" { + 2843 + } else if v == "2844" { + 2844 + } else if v == "2845" { + 2845 + } else if v == "2846" { + 2846 + } else if v == "2847" { + 2847 + } else if v == "2848" { + 2848 + } else if v == "2849" { + 2849 + } else if v == "2850" { + 2850 + } else if v == "2851" { + 2851 + } else if v == "2852" { + 2852 + } else if v == "2853" { + 2853 + } else if v == "2854" { + 2854 + } else if v == "2855" { + 2855 + } else if v == "2856" { + 2856 + } else if v == "2857" { + 2857 + } else if v == "2858" { + 2858 + } else if v == "2859" { + 2859 + } else if v == "2860" { + 2860 + } else if v == "2861" { + 2861 + } else if v == "2862" { + 2862 + } else if v == "2863" { + 2863 + } else if v == "2864" { + 2864 + } else if v == "2865" { + 2865 + } else if v == "2866" { + 2866 + } else if v == "2867" { + 2867 + } else if v == "2868" { + 2868 + } else if v == "2869" { + 2869 + } else if v == "2870" { + 2870 + } else if v == "2871" { + 2871 + } else if v == "2872" { + 2872 + } else if v == "2873" { + 2873 + } else if v == "2874" { + 2874 + } else if v == "2875" { + 2875 + } else if v == "2876" { + 2876 + } else if v == "2877" { + 2877 + } else if v == "2878" { + 2878 + } else if v == "2879" { + 2879 + } else if v == "2880" { + 2880 + } else if v == "2881" { + 2881 + } else if v == "2882" { + 2882 + } else if v == "2883" { + 2883 + } else if v == "2884" { + 2884 + } else if v == "2885" { + 2885 + } else if v == "2886" { + 2886 + } else if v == "2887" { + 2887 + } else if v == "2888" { + 2888 + } else if v == "2889" { + 2889 + } else if v == "2890" { + 2890 + } else if v == "2891" { + 2891 + } else if v == "2892" { + 2892 + } else if v == "2893" { + 2893 + } else if v == "2894" { + 2894 + } else if v == "2895" { + 2895 + } else if v == "2896" { + 2896 + } else if v == "2897" { + 2897 + } else if v == "2898" { + 2898 + } else if v == "2899" { + 2899 + } else if v == "2900" { + 2900 + } else if v == "2901" { + 2901 + } else if v == "2902" { + 2902 + } else if v == "2903" { + 2903 + } else if v == "2904" { + 2904 + } else if v == "2905" { + 2905 + } else if v == "2906" { + 2906 + } else if v == "2907" { + 2907 + } else if v == "2908" { + 2908 + } else if v == "2909" { + 2909 + } else if v == "2910" { + 2910 + } else if v == "2911" { + 2911 + } else if v == "2912" { + 2912 + } else if v == "2913" { + 2913 + } else if v == "2914" { + 2914 + } else if v == "2915" { + 2915 + } else if v == "2916" { + 2916 + } else if v == "2917" { + 2917 + } else if v == "2918" { + 2918 + } else if v == "2919" { + 2919 + } else if v == "2920" { + 2920 + } else if v == "2921" { + 2921 + } else if v == "2922" { + 2922 + } else if v == "2923" { + 2923 + } else if v == "2924" { + 2924 + } else if v == "2925" { + 2925 + } else if v == "2926" { + 2926 + } else if v == "2927" { + 2927 + } else if v == "2928" { + 2928 + } else if v == "2929" { + 2929 + } else if v == "2930" { + 2930 + } else if v == "2931" { + 2931 + } else if v == "2932" { + 2932 + } else if v == "2933" { + 2933 + } else if v == "2934" { + 2934 + } else if v == "2935" { + 2935 + } else if v == "2936" { + 2936 + } else if v == "2937" { + 2937 + } else if v == "2938" { + 2938 + } else if v == "2939" { + 2939 + } else if v == "2940" { + 2940 + } else if v == "2941" { + 2941 + } else if v == "2942" { + 2942 + } else if v == "2943" { + 2943 + } else if v == "2944" { + 2944 + } else if v == "2945" { + 2945 + } else if v == "2946" { + 2946 + } else if v == "2947" { + 2947 + } else if v == "2948" { + 2948 + } else if v == "2949" { + 2949 + } else if v == "2950" { + 2950 + } else if v == "2951" { + 2951 + } else if v == "2952" { + 2952 + } else if v == "2953" { + 2953 + } else if v == "2954" { + 2954 + } else if v == "2955" { + 2955 + } else if v == "2956" { + 2956 + } else if v == "2957" { + 2957 + } else if v == "2958" { + 2958 + } else if v == "2959" { + 2959 + } else if v == "2960" { + 2960 + } else if v == "2961" { + 2961 + } else if v == "2962" { + 2962 + } else if v == "2963" { + 2963 + } else if v == "2964" { + 2964 + } else if v == "2965" { + 2965 + } else if v == "2966" { + 2966 + } else if v == "2967" { + 2967 + } else if v == "2968" { + 2968 + } else if v == "2969" { + 2969 + } else if v == "2970" { + 2970 + } else if v == "2971" { + 2971 + } else if v == "2972" { + 2972 + } else if v == "2973" { + 2973 + } else if v == "2974" { + 2974 + } else if v == "2975" { + 2975 + } else if v == "2976" { + 2976 + } else if v == "2977" { + 2977 + } else if v == "2978" { + 2978 + } else if v == "2979" { + 2979 + } else if v == "2980" { + 2980 + } else if v == "2981" { + 2981 + } else if v == "2982" { + 2982 + } else if v == "2983" { + 2983 + } else if v == "2984" { + 2984 + } else if v == "2985" { + 2985 + } else if v == "2986" { + 2986 + } else if v == "2987" { + 2987 + } else if v == "2988" { + 2988 + } else if v == "2989" { + 2989 + } else if v == "2990" { + 2990 + } else if v == "2991" { + 2991 + } else if v == "2992" { + 2992 + } else if v == "2993" { + 2993 + } else if v == "2994" { + 2994 + } else if v == "2995" { + 2995 + } else if v == "2996" { + 2996 + } else if v == "2997" { + 2997 + } else if v == "2998" { + 2998 + } else if v == "2999" { + 2999 + } else if v == "3000" { + 3000 + } else if v == "3001" { + 3001 + } else if v == "3002" { + 3002 + } else if v == "3003" { + 3003 + } else if v == "3004" { + 3004 + } else if v == "3005" { + 3005 + } else if v == "3006" { + 3006 + } else if v == "3007" { + 3007 + } else if v == "3008" { + 3008 + } else if v == "3009" { + 3009 + } else if v == "3010" { + 3010 + } else if v == "3011" { + 3011 + } else if v == "3012" { + 3012 + } else if v == "3013" { + 3013 + } else if v == "3014" { + 3014 + } else if v == "3015" { + 3015 + } else if v == "3016" { + 3016 + } else if v == "3017" { + 3017 + } else if v == "3018" { + 3018 + } else if v == "3019" { + 3019 + } else if v == "3020" { + 3020 + } else if v == "3021" { + 3021 + } else if v == "3022" { + 3022 + } else if v == "3023" { + 3023 + } else if v == "3024" { + 3024 + } else if v == "3025" { + 3025 + } else if v == "3026" { + 3026 + } else if v == "3027" { + 3027 + } else if v == "3028" { + 3028 + } else if v == "3029" { + 3029 + } else if v == "3030" { + 3030 + } else if v == "3031" { + 3031 + } else if v == "3032" { + 3032 + } else if v == "3033" { + 3033 + } else if v == "3034" { + 3034 + } else if v == "3035" { + 3035 + } else if v == "3036" { + 3036 + } else if v == "3037" { + 3037 + } else if v == "3038" { + 3038 + } else if v == "3039" { + 3039 + } else if v == "3040" { + 3040 + } else if v == "3041" { + 3041 + } else if v == "3042" { + 3042 + } else if v == "3043" { + 3043 + } else if v == "3044" { + 3044 + } else if v == "3045" { + 3045 + } else if v == "3046" { + 3046 + } else if v == "3047" { + 3047 + } else if v == "3048" { + 3048 + } else if v == "3049" { + 3049 + } else if v == "3050" { + 3050 + } else if v == "3051" { + 3051 + } else if v == "3052" { + 3052 + } else if v == "3053" { + 3053 + } else if v == "3054" { + 3054 + } else if v == "3055" { + 3055 + } else if v == "3056" { + 3056 + } else if v == "3057" { + 3057 + } else if v == "3058" { + 3058 + } else if v == "3059" { + 3059 + } else if v == "3060" { + 3060 + } else if v == "3061" { + 3061 + } else if v == "3062" { + 3062 + } else if v == "3063" { + 3063 + } else if v == "3064" { + 3064 + } else if v == "3065" { + 3065 + } else if v == "3066" { + 3066 + } else if v == "3067" { + 3067 + } else if v == "3068" { + 3068 + } else if v == "3069" { + 3069 + } else if v == "3070" { + 3070 + } else if v == "3071" { + 3071 + } else if v == "3072" { + 3072 + } else if v == "3073" { + 3073 + } else if v == "3074" { + 3074 + } else if v == "3075" { + 3075 + } else if v == "3076" { + 3076 + } else if v == "3077" { + 3077 + } else if v == "3078" { + 3078 + } else if v == "3079" { + 3079 + } else if v == "3080" { + 3080 + } else if v == "3081" { + 3081 + } else if v == "3082" { + 3082 + } else if v == "3083" { + 3083 + } else if v == "3084" { + 3084 + } else if v == "3085" { + 3085 + } else if v == "3086" { + 3086 + } else if v == "3087" { + 3087 + } else if v == "3088" { + 3088 + } else if v == "3089" { + 3089 + } else if v == "3090" { + 3090 + } else if v == "3091" { + 3091 + } else if v == "3092" { + 3092 + } else if v == "3093" { + 3093 + } else if v == "3094" { + 3094 + } else if v == "3095" { + 3095 + } else if v == "3096" { + 3096 + } else if v == "3097" { + 3097 + } else if v == "3098" { + 3098 + } else if v == "3099" { + 3099 + } else if v == "3100" { + 3100 + } else if v == "3101" { + 3101 + } else if v == "3102" { + 3102 + } else if v == "3103" { + 3103 + } else if v == "3104" { + 3104 + } else if v == "3105" { + 3105 + } else if v == "3106" { + 3106 + } else if v == "3107" { + 3107 + } else if v == "3108" { + 3108 + } else if v == "3109" { + 3109 + } else if v == "3110" { + 3110 + } else if v == "3111" { + 3111 + } else if v == "3112" { + 3112 + } else if v == "3113" { + 3113 + } else if v == "3114" { + 3114 + } else if v == "3115" { + 3115 + } else if v == "3116" { + 3116 + } else if v == "3117" { + 3117 + } else if v == "3118" { + 3118 + } else if v == "3119" { + 3119 + } else if v == "3120" { + 3120 + } else if v == "3121" { + 3121 + } else if v == "3122" { + 3122 + } else if v == "3123" { + 3123 + } else if v == "3124" { + 3124 + } else if v == "3125" { + 3125 + } else if v == "3126" { + 3126 + } else if v == "3127" { + 3127 + } else if v == "3128" { + 3128 + } else if v == "3129" { + 3129 + } else if v == "3130" { + 3130 + } else if v == "3131" { + 3131 + } else if v == "3132" { + 3132 + } else if v == "3133" { + 3133 + } else if v == "3134" { + 3134 + } else if v == "3135" { + 3135 + } else if v == "3136" { + 3136 + } else if v == "3137" { + 3137 + } else if v == "3138" { + 3138 + } else if v == "3139" { + 3139 + } else if v == "3140" { + 3140 + } else if v == "3141" { + 3141 + } else if v == "3142" { + 3142 + } else if v == "3143" { + 3143 + } else if v == "3144" { + 3144 + } else if v == "3145" { + 3145 + } else if v == "3146" { + 3146 + } else if v == "3147" { + 3147 + } else if v == "3148" { + 3148 + } else if v == "3149" { + 3149 + } else if v == "3150" { + 3150 + } else if v == "3151" { + 3151 + } else if v == "3152" { + 3152 + } else if v == "3153" { + 3153 + } else if v == "3154" { + 3154 + } else if v == "3155" { + 3155 + } else if v == "3156" { + 3156 + } else if v == "3157" { + 3157 + } else if v == "3158" { + 3158 + } else if v == "3159" { + 3159 + } else if v == "3160" { + 3160 + } else if v == "3161" { + 3161 + } else if v == "3162" { + 3162 + } else if v == "3163" { + 3163 + } else if v == "3164" { + 3164 + } else if v == "3165" { + 3165 + } else if v == "3166" { + 3166 + } else if v == "3167" { + 3167 + } else if v == "3168" { + 3168 + } else if v == "3169" { + 3169 + } else if v == "3170" { + 3170 + } else if v == "3171" { + 3171 + } else if v == "3172" { + 3172 + } else if v == "3173" { + 3173 + } else if v == "3174" { + 3174 + } else if v == "3175" { + 3175 + } else if v == "3176" { + 3176 + } else if v == "3177" { + 3177 + } else if v == "3178" { + 3178 + } else if v == "3179" { + 3179 + } else if v == "3180" { + 3180 + } else if v == "3181" { + 3181 + } else if v == "3182" { + 3182 + } else if v == "3183" { + 3183 + } else if v == "3184" { + 3184 + } else if v == "3185" { + 3185 + } else if v == "3186" { + 3186 + } else if v == "3187" { + 3187 + } else if v == "3188" { + 3188 + } else if v == "3189" { + 3189 + } else if v == "3190" { + 3190 + } else if v == "3191" { + 3191 + } else if v == "3192" { + 3192 + } else if v == "3193" { + 3193 + } else if v == "3194" { + 3194 + } else if v == "3195" { + 3195 + } else if v == "3196" { + 3196 + } else if v == "3197" { + 3197 + } else if v == "3198" { + 3198 + } else if v == "3199" { + 3199 + } else if v == "3200" { + 3200 + } else if v == "3201" { + 3201 + } else if v == "3202" { + 3202 + } else if v == "3203" { + 3203 + } else if v == "3204" { + 3204 + } else if v == "3205" { + 3205 + } else if v == "3206" { + 3206 + } else if v == "3207" { + 3207 + } else if v == "3208" { + 3208 + } else if v == "3209" { + 3209 + } else if v == "3210" { + 3210 + } else if v == "3211" { + 3211 + } else if v == "3212" { + 3212 + } else if v == "3213" { + 3213 + } else if v == "3214" { + 3214 + } else if v == "3215" { + 3215 + } else if v == "3216" { + 3216 + } else if v == "3217" { + 3217 + } else if v == "3218" { + 3218 + } else if v == "3219" { + 3219 + } else if v == "3220" { + 3220 + } else if v == "3221" { + 3221 + } else if v == "3222" { + 3222 + } else if v == "3223" { + 3223 + } else if v == "3224" { + 3224 + } else if v == "3225" { + 3225 + } else if v == "3226" { + 3226 + } else if v == "3227" { + 3227 + } else if v == "3228" { + 3228 + } else if v == "3229" { + 3229 + } else if v == "3230" { + 3230 + } else if v == "3231" { + 3231 + } else if v == "3232" { + 3232 + } else if v == "3233" { + 3233 + } else if v == "3234" { + 3234 + } else if v == "3235" { + 3235 + } else if v == "3236" { + 3236 + } else if v == "3237" { + 3237 + } else if v == "3238" { + 3238 + } else if v == "3239" { + 3239 + } else if v == "3240" { + 3240 + } else if v == "3241" { + 3241 + } else if v == "3242" { + 3242 + } else if v == "3243" { + 3243 + } else if v == "3244" { + 3244 + } else if v == "3245" { + 3245 + } else if v == "3246" { + 3246 + } else if v == "3247" { + 3247 + } else if v == "3248" { + 3248 + } else if v == "3249" { + 3249 + } else if v == "3250" { + 3250 + } else if v == "3251" { + 3251 + } else if v == "3252" { + 3252 + } else if v == "3253" { + 3253 + } else if v == "3254" { + 3254 + } else if v == "3255" { + 3255 + } else if v == "3256" { + 3256 + } else if v == "3257" { + 3257 + } else if v == "3258" { + 3258 + } else if v == "3259" { + 3259 + } else if v == "3260" { + 3260 + } else if v == "3261" { + 3261 + } else if v == "3262" { + 3262 + } else if v == "3263" { + 3263 + } else if v == "3264" { + 3264 + } else if v == "3265" { + 3265 + } else if v == "3266" { + 3266 + } else if v == "3267" { + 3267 + } else if v == "3268" { + 3268 + } else if v == "3269" { + 3269 + } else if v == "3270" { + 3270 + } else if v == "3271" { + 3271 + } else if v == "3272" { + 3272 + } else if v == "3273" { + 3273 + } else if v == "3274" { + 3274 + } else if v == "3275" { + 3275 + } else if v == "3276" { + 3276 + } else if v == "3277" { + 3277 + } else if v == "3278" { + 3278 + } else if v == "3279" { + 3279 + } else if v == "3280" { + 3280 + } else if v == "3281" { + 3281 + } else if v == "3282" { + 3282 + } else if v == "3283" { + 3283 + } else if v == "3284" { + 3284 + } else if v == "3285" { + 3285 + } else if v == "3286" { + 3286 + } else if v == "3287" { + 3287 + } else if v == "3288" { + 3288 + } else if v == "3289" { + 3289 + } else if v == "3290" { + 3290 + } else if v == "3291" { + 3291 + } else if v == "3292" { + 3292 + } else if v == "3293" { + 3293 + } else if v == "3294" { + 3294 + } else if v == "3295" { + 3295 + } else if v == "3296" { + 3296 + } else if v == "3297" { + 3297 + } else if v == "3298" { + 3298 + } else if v == "3299" { + 3299 + } else if v == "3300" { + 3300 + } else if v == "3301" { + 3301 + } else if v == "3302" { + 3302 + } else if v == "3303" { + 3303 + } else if v == "3304" { + 3304 + } else if v == "3305" { + 3305 + } else if v == "3306" { + 3306 + } else if v == "3307" { + 3307 + } else if v == "3308" { + 3308 + } else if v == "3309" { + 3309 + } else if v == "3310" { + 3310 + } else if v == "3311" { + 3311 + } else if v == "3312" { + 3312 + } else if v == "3313" { + 3313 + } else if v == "3314" { + 3314 + } else if v == "3315" { + 3315 + } else if v == "3316" { + 3316 + } else if v == "3317" { + 3317 + } else if v == "3318" { + 3318 + } else if v == "3319" { + 3319 + } else if v == "3320" { + 3320 + } else if v == "3321" { + 3321 + } else if v == "3322" { + 3322 + } else if v == "3323" { + 3323 + } else if v == "3324" { + 3324 + } else if v == "3325" { + 3325 + } else if v == "3326" { + 3326 + } else if v == "3327" { + 3327 + } else if v == "3328" { + 3328 + } else if v == "3329" { + 3329 + } else if v == "3330" { + 3330 + } else if v == "3331" { + 3331 + } else if v == "3332" { + 3332 + } else if v == "3333" { + 3333 + } else if v == "3334" { + 3334 + } else if v == "3335" { + 3335 + } else if v == "3336" { + 3336 + } else if v == "3337" { + 3337 + } else if v == "3338" { + 3338 + } else if v == "3339" { + 3339 + } else if v == "3340" { + 3340 + } else if v == "3341" { + 3341 + } else if v == "3342" { + 3342 + } else if v == "3343" { + 3343 + } else if v == "3344" { + 3344 + } else if v == "3345" { + 3345 + } else if v == "3346" { + 3346 + } else if v == "3347" { + 3347 + } else if v == "3348" { + 3348 + } else if v == "3349" { + 3349 + } else if v == "3350" { + 3350 + } else if v == "3351" { + 3351 + } else if v == "3352" { + 3352 + } else if v == "3353" { + 3353 + } else if v == "3354" { + 3354 + } else if v == "3355" { + 3355 + } else if v == "3356" { + 3356 + } else if v == "3357" { + 3357 + } else if v == "3358" { + 3358 + } else if v == "3359" { + 3359 + } else if v == "3360" { + 3360 + } else if v == "3361" { + 3361 + } else if v == "3362" { + 3362 + } else if v == "3363" { + 3363 + } else if v == "3364" { + 3364 + } else if v == "3365" { + 3365 + } else if v == "3366" { + 3366 + } else if v == "3367" { + 3367 + } else if v == "3368" { + 3368 + } else if v == "3369" { + 3369 + } else if v == "3370" { + 3370 + } else if v == "3371" { + 3371 + } else if v == "3372" { + 3372 + } else if v == "3373" { + 3373 + } else if v == "3374" { + 3374 + } else if v == "3375" { + 3375 + } else if v == "3376" { + 3376 + } else if v == "3377" { + 3377 + } else if v == "3378" { + 3378 + } else if v == "3379" { + 3379 + } else if v == "3380" { + 3380 + } else if v == "3381" { + 3381 + } else if v == "3382" { + 3382 + } else if v == "3383" { + 3383 + } else if v == "3384" { + 3384 + } else if v == "3385" { + 3385 + } else if v == "3386" { + 3386 + } else if v == "3387" { + 3387 + } else if v == "3388" { + 3388 + } else if v == "3389" { + 3389 + } else if v == "3390" { + 3390 + } else if v == "3391" { + 3391 + } else if v == "3392" { + 3392 + } else if v == "3393" { + 3393 + } else if v == "3394" { + 3394 + } else if v == "3395" { + 3395 + } else if v == "3396" { + 3396 + } else if v == "3397" { + 3397 + } else if v == "3398" { + 3398 + } else if v == "3399" { + 3399 + } else if v == "3400" { + 3400 + } else if v == "3401" { + 3401 + } else if v == "3402" { + 3402 + } else if v == "3403" { + 3403 + } else if v == "3404" { + 3404 + } else if v == "3405" { + 3405 + } else if v == "3406" { + 3406 + } else if v == "3407" { + 3407 + } else if v == "3408" { + 3408 + } else if v == "3409" { + 3409 + } else if v == "3410" { + 3410 + } else if v == "3411" { + 3411 + } else if v == "3412" { + 3412 + } else if v == "3413" { + 3413 + } else if v == "3414" { + 3414 + } else if v == "3415" { + 3415 + } else if v == "3416" { + 3416 + } else if v == "3417" { + 3417 + } else if v == "3418" { + 3418 + } else if v == "3419" { + 3419 + } else if v == "3420" { + 3420 + } else if v == "3421" { + 3421 + } else if v == "3422" { + 3422 + } else if v == "3423" { + 3423 + } else if v == "3424" { + 3424 + } else if v == "3425" { + 3425 + } else if v == "3426" { + 3426 + } else if v == "3427" { + 3427 + } else if v == "3428" { + 3428 + } else if v == "3429" { + 3429 + } else if v == "3430" { + 3430 + } else if v == "3431" { + 3431 + } else if v == "3432" { + 3432 + } else if v == "3433" { + 3433 + } else if v == "3434" { + 3434 + } else if v == "3435" { + 3435 + } else if v == "3436" { + 3436 + } else if v == "3437" { + 3437 + } else if v == "3438" { + 3438 + } else if v == "3439" { + 3439 + } else if v == "3440" { + 3440 + } else if v == "3441" { + 3441 + } else if v == "3442" { + 3442 + } else if v == "3443" { + 3443 + } else if v == "3444" { + 3444 + } else if v == "3445" { + 3445 + } else if v == "3446" { + 3446 + } else if v == "3447" { + 3447 + } else if v == "3448" { + 3448 + } else if v == "3449" { + 3449 + } else if v == "3450" { + 3450 + } else if v == "3451" { + 3451 + } else if v == "3452" { + 3452 + } else if v == "3453" { + 3453 + } else if v == "3454" { + 3454 + } else if v == "3455" { + 3455 + } else if v == "3456" { + 3456 + } else if v == "3457" { + 3457 + } else if v == "3458" { + 3458 + } else if v == "3459" { + 3459 + } else if v == "3460" { + 3460 + } else if v == "3461" { + 3461 + } else if v == "3462" { + 3462 + } else if v == "3463" { + 3463 + } else if v == "3464" { + 3464 + } else if v == "3465" { + 3465 + } else if v == "3466" { + 3466 + } else if v == "3467" { + 3467 + } else if v == "3468" { + 3468 + } else if v == "3469" { + 3469 + } else if v == "3470" { + 3470 + } else if v == "3471" { + 3471 + } else if v == "3472" { + 3472 + } else if v == "3473" { + 3473 + } else if v == "3474" { + 3474 + } else if v == "3475" { + 3475 + } else if v == "3476" { + 3476 + } else if v == "3477" { + 3477 + } else if v == "3478" { + 3478 + } else if v == "3479" { + 3479 + } else if v == "3480" { + 3480 + } else if v == "3481" { + 3481 + } else if v == "3482" { + 3482 + } else if v == "3483" { + 3483 + } else if v == "3484" { + 3484 + } else if v == "3485" { + 3485 + } else if v == "3486" { + 3486 + } else if v == "3487" { + 3487 + } else if v == "3488" { + 3488 + } else if v == "3489" { + 3489 + } else if v == "3490" { + 3490 + } else if v == "3491" { + 3491 + } else if v == "3492" { + 3492 + } else if v == "3493" { + 3493 + } else if v == "3494" { + 3494 + } else if v == "3495" { + 3495 + } else if v == "3496" { + 3496 + } else if v == "3497" { + 3497 + } else if v == "3498" { + 3498 + } else if v == "3499" { + 3499 + } else if v == "3500" { + 3500 + } else if v == "3501" { + 3501 + } else if v == "3502" { + 3502 + } else if v == "3503" { + 3503 + } else if v == "3504" { + 3504 + } else if v == "3505" { + 3505 + } else if v == "3506" { + 3506 + } else if v == "3507" { + 3507 + } else if v == "3508" { + 3508 + } else if v == "3509" { + 3509 + } else if v == "3510" { + 3510 + } else if v == "3511" { + 3511 + } else if v == "3512" { + 3512 + } else if v == "3513" { + 3513 + } else if v == "3514" { + 3514 + } else if v == "3515" { + 3515 + } else if v == "3516" { + 3516 + } else if v == "3517" { + 3517 + } else if v == "3518" { + 3518 + } else if v == "3519" { + 3519 + } else if v == "3520" { + 3520 + } else if v == "3521" { + 3521 + } else if v == "3522" { + 3522 + } else if v == "3523" { + 3523 + } else if v == "3524" { + 3524 + } else if v == "3525" { + 3525 + } else if v == "3526" { + 3526 + } else if v == "3527" { + 3527 + } else if v == "3528" { + 3528 + } else if v == "3529" { + 3529 + } else if v == "3530" { + 3530 + } else if v == "3531" { + 3531 + } else if v == "3532" { + 3532 + } else if v == "3533" { + 3533 + } else if v == "3534" { + 3534 + } else if v == "3535" { + 3535 + } else if v == "3536" { + 3536 + } else if v == "3537" { + 3537 + } else if v == "3538" { + 3538 + } else if v == "3539" { + 3539 + } else if v == "3540" { + 3540 + } else if v == "3541" { + 3541 + } else if v == "3542" { + 3542 + } else if v == "3543" { + 3543 + } else if v == "3544" { + 3544 + } else if v == "3545" { + 3545 + } else if v == "3546" { + 3546 + } else if v == "3547" { + 3547 + } else if v == "3548" { + 3548 + } else if v == "3549" { + 3549 + } else if v == "3550" { + 3550 + } else if v == "3551" { + 3551 + } else if v == "3552" { + 3552 + } else if v == "3553" { + 3553 + } else if v == "3554" { + 3554 + } else if v == "3555" { + 3555 + } else if v == "3556" { + 3556 + } else if v == "3557" { + 3557 + } else if v == "3558" { + 3558 + } else if v == "3559" { + 3559 + } else if v == "3560" { + 3560 + } else if v == "3561" { + 3561 + } else if v == "3562" { + 3562 + } else if v == "3563" { + 3563 + } else if v == "3564" { + 3564 + } else if v == "3565" { + 3565 + } else if v == "3566" { + 3566 + } else if v == "3567" { + 3567 + } else if v == "3568" { + 3568 + } else if v == "3569" { + 3569 + } else if v == "3570" { + 3570 + } else if v == "3571" { + 3571 + } else if v == "3572" { + 3572 + } else if v == "3573" { + 3573 + } else if v == "3574" { + 3574 + } else if v == "3575" { + 3575 + } else if v == "3576" { + 3576 + } else if v == "3577" { + 3577 + } else if v == "3578" { + 3578 + } else if v == "3579" { + 3579 + } else if v == "3580" { + 3580 + } else if v == "3581" { + 3581 + } else if v == "3582" { + 3582 + } else if v == "3583" { + 3583 + } else if v == "3584" { + 3584 + } else if v == "3585" { + 3585 + } else if v == "3586" { + 3586 + } else if v == "3587" { + 3587 + } else if v == "3588" { + 3588 + } else if v == "3589" { + 3589 + } else if v == "3590" { + 3590 + } else if v == "3591" { + 3591 + } else if v == "3592" { + 3592 + } else if v == "3593" { + 3593 + } else if v == "3594" { + 3594 + } else if v == "3595" { + 3595 + } else if v == "3596" { + 3596 + } else if v == "3597" { + 3597 + } else if v == "3598" { + 3598 + } else if v == "3599" { + 3599 + } else if v == "3600" { + 3600 + } else if v == "3601" { + 3601 + } else if v == "3602" { + 3602 + } else if v == "3603" { + 3603 + } else if v == "3604" { + 3604 + } else if v == "3605" { + 3605 + } else if v == "3606" { + 3606 + } else if v == "3607" { + 3607 + } else if v == "3608" { + 3608 + } else if v == "3609" { + 3609 + } else if v == "3610" { + 3610 + } else if v == "3611" { + 3611 + } else if v == "3612" { + 3612 + } else if v == "3613" { + 3613 + } else if v == "3614" { + 3614 + } else if v == "3615" { + 3615 + } else if v == "3616" { + 3616 + } else if v == "3617" { + 3617 + } else if v == "3618" { + 3618 + } else if v == "3619" { + 3619 + } else if v == "3620" { + 3620 + } else if v == "3621" { + 3621 + } else if v == "3622" { + 3622 + } else if v == "3623" { + 3623 + } else if v == "3624" { + 3624 + } else if v == "3625" { + 3625 + } else if v == "3626" { + 3626 + } else if v == "3627" { + 3627 + } else if v == "3628" { + 3628 + } else if v == "3629" { + 3629 + } else if v == "3630" { + 3630 + } else if v == "3631" { + 3631 + } else if v == "3632" { + 3632 + } else if v == "3633" { + 3633 + } else if v == "3634" { + 3634 + } else if v == "3635" { + 3635 + } else if v == "3636" { + 3636 + } else if v == "3637" { + 3637 + } else if v == "3638" { + 3638 + } else if v == "3639" { + 3639 + } else if v == "3640" { + 3640 + } else if v == "3641" { + 3641 + } else if v == "3642" { + 3642 + } else if v == "3643" { + 3643 + } else if v == "3644" { + 3644 + } else if v == "3645" { + 3645 + } else if v == "3646" { + 3646 + } else if v == "3647" { + 3647 + } else if v == "3648" { + 3648 + } else if v == "3649" { + 3649 + } else if v == "3650" { + 3650 + } else if v == "3651" { + 3651 + } else if v == "3652" { + 3652 + } else if v == "3653" { + 3653 + } else if v == "3654" { + 3654 + } else if v == "3655" { + 3655 + } else if v == "3656" { + 3656 + } else if v == "3657" { + 3657 + } else if v == "3658" { + 3658 + } else if v == "3659" { + 3659 + } else if v == "3660" { + 3660 + } else if v == "3661" { + 3661 + } else if v == "3662" { + 3662 + } else if v == "3663" { + 3663 + } else if v == "3664" { + 3664 + } else if v == "3665" { + 3665 + } else if v == "3666" { + 3666 + } else if v == "3667" { + 3667 + } else if v == "3668" { + 3668 + } else if v == "3669" { + 3669 + } else if v == "3670" { + 3670 + } else if v == "3671" { + 3671 + } else if v == "3672" { + 3672 + } else if v == "3673" { + 3673 + } else if v == "3674" { + 3674 + } else if v == "3675" { + 3675 + } else if v == "3676" { + 3676 + } else if v == "3677" { + 3677 + } else if v == "3678" { + 3678 + } else if v == "3679" { + 3679 + } else if v == "3680" { + 3680 + } else if v == "3681" { + 3681 + } else if v == "3682" { + 3682 + } else if v == "3683" { + 3683 + } else if v == "3684" { + 3684 + } else if v == "3685" { + 3685 + } else if v == "3686" { + 3686 + } else if v == "3687" { + 3687 + } else if v == "3688" { + 3688 + } else if v == "3689" { + 3689 + } else if v == "3690" { + 3690 + } else if v == "3691" { + 3691 + } else if v == "3692" { + 3692 + } else if v == "3693" { + 3693 + } else if v == "3694" { + 3694 + } else if v == "3695" { + 3695 + } else if v == "3696" { + 3696 + } else if v == "3697" { + 3697 + } else if v == "3698" { + 3698 + } else if v == "3699" { + 3699 + } else if v == "3700" { + 3700 + } else if v == "3701" { + 3701 + } else if v == "3702" { + 3702 + } else if v == "3703" { + 3703 + } else if v == "3704" { + 3704 + } else if v == "3705" { + 3705 + } else if v == "3706" { + 3706 + } else if v == "3707" { + 3707 + } else if v == "3708" { + 3708 + } else if v == "3709" { + 3709 + } else if v == "3710" { + 3710 + } else if v == "3711" { + 3711 + } else if v == "3712" { + 3712 + } else if v == "3713" { + 3713 + } else if v == "3714" { + 3714 + } else if v == "3715" { + 3715 + } else if v == "3716" { + 3716 + } else if v == "3717" { + 3717 + } else if v == "3718" { + 3718 + } else if v == "3719" { + 3719 + } else if v == "3720" { + 3720 + } else if v == "3721" { + 3721 + } else if v == "3722" { + 3722 + } else if v == "3723" { + 3723 + } else if v == "3724" { + 3724 + } else if v == "3725" { + 3725 + } else if v == "3726" { + 3726 + } else if v == "3727" { + 3727 + } else if v == "3728" { + 3728 + } else if v == "3729" { + 3729 + } else if v == "3730" { + 3730 + } else if v == "3731" { + 3731 + } else if v == "3732" { + 3732 + } else if v == "3733" { + 3733 + } else if v == "3734" { + 3734 + } else if v == "3735" { + 3735 + } else if v == "3736" { + 3736 + } else if v == "3737" { + 3737 + } else if v == "3738" { + 3738 + } else if v == "3739" { + 3739 + } else if v == "3740" { + 3740 + } else if v == "3741" { + 3741 + } else if v == "3742" { + 3742 + } else if v == "3743" { + 3743 + } else if v == "3744" { + 3744 + } else if v == "3745" { + 3745 + } else if v == "3746" { + 3746 + } else if v == "3747" { + 3747 + } else if v == "3748" { + 3748 + } else if v == "3749" { + 3749 + } else if v == "3750" { + 3750 + } else if v == "3751" { + 3751 + } else if v == "3752" { + 3752 + } else if v == "3753" { + 3753 + } else if v == "3754" { + 3754 + } else if v == "3755" { + 3755 + } else if v == "3756" { + 3756 + } else if v == "3757" { + 3757 + } else if v == "3758" { + 3758 + } else if v == "3759" { + 3759 + } else if v == "3760" { + 3760 + } else if v == "3761" { + 3761 + } else if v == "3762" { + 3762 + } else if v == "3763" { + 3763 + } else if v == "3764" { + 3764 + } else if v == "3765" { + 3765 + } else if v == "3766" { + 3766 + } else if v == "3767" { + 3767 + } else if v == "3768" { + 3768 + } else if v == "3769" { + 3769 + } else if v == "3770" { + 3770 + } else if v == "3771" { + 3771 + } else if v == "3772" { + 3772 + } else if v == "3773" { + 3773 + } else if v == "3774" { + 3774 + } else if v == "3775" { + 3775 + } else if v == "3776" { + 3776 + } else if v == "3777" { + 3777 + } else if v == "3778" { + 3778 + } else if v == "3779" { + 3779 + } else if v == "3780" { + 3780 + } else if v == "3781" { + 3781 + } else if v == "3782" { + 3782 + } else if v == "3783" { + 3783 + } else if v == "3784" { + 3784 + } else if v == "3785" { + 3785 + } else if v == "3786" { + 3786 + } else if v == "3787" { + 3787 + } else if v == "3788" { + 3788 + } else if v == "3789" { + 3789 + } else if v == "3790" { + 3790 + } else if v == "3791" { + 3791 + } else if v == "3792" { + 3792 + } else if v == "3793" { + 3793 + } else if v == "3794" { + 3794 + } else if v == "3795" { + 3795 + } else if v == "3796" { + 3796 + } else if v == "3797" { + 3797 + } else if v == "3798" { + 3798 + } else if v == "3799" { + 3799 + } else if v == "3800" { + 3800 + } else if v == "3801" { + 3801 + } else if v == "3802" { + 3802 + } else if v == "3803" { + 3803 + } else if v == "3804" { + 3804 + } else if v == "3805" { + 3805 + } else if v == "3806" { + 3806 + } else if v == "3807" { + 3807 + } else if v == "3808" { + 3808 + } else if v == "3809" { + 3809 + } else if v == "3810" { + 3810 + } else if v == "3811" { + 3811 + } else if v == "3812" { + 3812 + } else if v == "3813" { + 3813 + } else if v == "3814" { + 3814 + } else if v == "3815" { + 3815 + } else if v == "3816" { + 3816 + } else if v == "3817" { + 3817 + } else if v == "3818" { + 3818 + } else if v == "3819" { + 3819 + } else if v == "3820" { + 3820 + } else if v == "3821" { + 3821 + } else if v == "3822" { + 3822 + } else if v == "3823" { + 3823 + } else if v == "3824" { + 3824 + } else if v == "3825" { + 3825 + } else if v == "3826" { + 3826 + } else if v == "3827" { + 3827 + } else if v == "3828" { + 3828 + } else if v == "3829" { + 3829 + } else if v == "3830" { + 3830 + } else if v == "3831" { + 3831 + } else if v == "3832" { + 3832 + } else if v == "3833" { + 3833 + } else if v == "3834" { + 3834 + } else if v == "3835" { + 3835 + } else if v == "3836" { + 3836 + } else if v == "3837" { + 3837 + } else if v == "3838" { + 3838 + } else if v == "3839" { + 3839 + } else if v == "3840" { + 3840 + } else if v == "3841" { + 3841 + } else if v == "3842" { + 3842 + } else if v == "3843" { + 3843 + } else if v == "3844" { + 3844 + } else if v == "3845" { + 3845 + } else if v == "3846" { + 3846 + } else if v == "3847" { + 3847 + } else if v == "3848" { + 3848 + } else if v == "3849" { + 3849 + } else if v == "3850" { + 3850 + } else if v == "3851" { + 3851 + } else if v == "3852" { + 3852 + } else if v == "3853" { + 3853 + } else if v == "3854" { + 3854 + } else if v == "3855" { + 3855 + } else if v == "3856" { + 3856 + } else if v == "3857" { + 3857 + } else if v == "3858" { + 3858 + } else if v == "3859" { + 3859 + } else if v == "3860" { + 3860 + } else if v == "3861" { + 3861 + } else if v == "3862" { + 3862 + } else if v == "3863" { + 3863 + } else if v == "3864" { + 3864 + } else if v == "3865" { + 3865 + } else if v == "3866" { + 3866 + } else if v == "3867" { + 3867 + } else if v == "3868" { + 3868 + } else if v == "3869" { + 3869 + } else if v == "3870" { + 3870 + } else if v == "3871" { + 3871 + } else if v == "3872" { + 3872 + } else if v == "3873" { + 3873 + } else if v == "3874" { + 3874 + } else if v == "3875" { + 3875 + } else if v == "3876" { + 3876 + } else if v == "3877" { + 3877 + } else if v == "3878" { + 3878 + } else if v == "3879" { + 3879 + } else if v == "3880" { + 3880 + } else if v == "3881" { + 3881 + } else if v == "3882" { + 3882 + } else if v == "3883" { + 3883 + } else if v == "3884" { + 3884 + } else if v == "3885" { + 3885 + } else if v == "3886" { + 3886 + } else if v == "3887" { + 3887 + } else if v == "3888" { + 3888 + } else if v == "3889" { + 3889 + } else if v == "3890" { + 3890 + } else if v == "3891" { + 3891 + } else if v == "3892" { + 3892 + } else if v == "3893" { + 3893 + } else if v == "3894" { + 3894 + } else if v == "3895" { + 3895 + } else if v == "3896" { + 3896 + } else if v == "3897" { + 3897 + } else if v == "3898" { + 3898 + } else if v == "3899" { + 3899 + } else if v == "3900" { + 3900 + } else if v == "3901" { + 3901 + } else if v == "3902" { + 3902 + } else if v == "3903" { + 3903 + } else if v == "3904" { + 3904 + } else if v == "3905" { + 3905 + } else if v == "3906" { + 3906 + } else if v == "3907" { + 3907 + } else if v == "3908" { + 3908 + } else if v == "3909" { + 3909 + } else if v == "3910" { + 3910 + } else if v == "3911" { + 3911 + } else if v == "3912" { + 3912 + } else if v == "3913" { + 3913 + } else if v == "3914" { + 3914 + } else if v == "3915" { + 3915 + } else if v == "3916" { + 3916 + } else if v == "3917" { + 3917 + } else if v == "3918" { + 3918 + } else if v == "3919" { + 3919 + } else if v == "3920" { + 3920 + } else if v == "3921" { + 3921 + } else if v == "3922" { + 3922 + } else if v == "3923" { + 3923 + } else if v == "3924" { + 3924 + } else if v == "3925" { + 3925 + } else if v == "3926" { + 3926 + } else if v == "3927" { + 3927 + } else if v == "3928" { + 3928 + } else if v == "3929" { + 3929 + } else if v == "3930" { + 3930 + } else if v == "3931" { + 3931 + } else if v == "3932" { + 3932 + } else if v == "3933" { + 3933 + } else if v == "3934" { + 3934 + } else if v == "3935" { + 3935 + } else if v == "3936" { + 3936 + } else if v == "3937" { + 3937 + } else if v == "3938" { + 3938 + } else if v == "3939" { + 3939 + } else if v == "3940" { + 3940 + } else if v == "3941" { + 3941 + } else if v == "3942" { + 3942 + } else if v == "3943" { + 3943 + } else if v == "3944" { + 3944 + } else if v == "3945" { + 3945 + } else if v == "3946" { + 3946 + } else if v == "3947" { + 3947 + } else if v == "3948" { + 3948 + } else if v == "3949" { + 3949 + } else if v == "3950" { + 3950 + } else if v == "3951" { + 3951 + } else if v == "3952" { + 3952 + } else if v == "3953" { + 3953 + } else if v == "3954" { + 3954 + } else if v == "3955" { + 3955 + } else if v == "3956" { + 3956 + } else if v == "3957" { + 3957 + } else if v == "3958" { + 3958 + } else if v == "3959" { + 3959 + } else if v == "3960" { + 3960 + } else if v == "3961" { + 3961 + } else if v == "3962" { + 3962 + } else if v == "3963" { + 3963 + } else if v == "3964" { + 3964 + } else if v == "3965" { + 3965 + } else if v == "3966" { + 3966 + } else if v == "3967" { + 3967 + } else if v == "3968" { + 3968 + } else if v == "3969" { + 3969 + } else if v == "3970" { + 3970 + } else if v == "3971" { + 3971 + } else if v == "3972" { + 3972 + } else if v == "3973" { + 3973 + } else if v == "3974" { + 3974 + } else if v == "3975" { + 3975 + } else if v == "3976" { + 3976 + } else if v == "3977" { + 3977 + } else if v == "3978" { + 3978 + } else if v == "3979" { + 3979 + } else if v == "3980" { + 3980 + } else if v == "3981" { + 3981 + } else if v == "3982" { + 3982 + } else if v == "3983" { + 3983 + } else if v == "3984" { + 3984 + } else if v == "3985" { + 3985 + } else if v == "3986" { + 3986 + } else if v == "3987" { + 3987 + } else if v == "3988" { + 3988 + } else if v == "3989" { + 3989 + } else if v == "3990" { + 3990 + } else if v == "3991" { + 3991 + } else if v == "3992" { + 3992 + } else if v == "3993" { + 3993 + } else if v == "3994" { + 3994 + } else if v == "3995" { + 3995 + } else if v == "3996" { + 3996 + } else if v == "3997" { + 3997 + } else if v == "3998" { + 3998 + } else if v == "3999" { + 3999 + } else if v == "4000" { + 4000 + } else if v == "4001" { + 4001 + } else if v == "4002" { + 4002 + } else if v == "4003" { + 4003 + } else if v == "4004" { + 4004 + } else if v == "4005" { + 4005 + } else if v == "4006" { + 4006 + } else if v == "4007" { + 4007 + } else if v == "4008" { + 4008 + } else if v == "4009" { + 4009 + } else if v == "4010" { + 4010 + } else if v == "4011" { + 4011 + } else if v == "4012" { + 4012 + } else if v == "4013" { + 4013 + } else if v == "4014" { + 4014 + } else if v == "4015" { + 4015 + } else if v == "4016" { + 4016 + } else if v == "4017" { + 4017 + } else if v == "4018" { + 4018 + } else if v == "4019" { + 4019 + } else if v == "4020" { + 4020 + } else if v == "4021" { + 4021 + } else if v == "4022" { + 4022 + } else if v == "4023" { + 4023 + } else if v == "4024" { + 4024 + } else if v == "4025" { + 4025 + } else if v == "4026" { + 4026 + } else if v == "4027" { + 4027 + } else if v == "4028" { + 4028 + } else if v == "4029" { + 4029 + } else if v == "4030" { + 4030 + } else if v == "4031" { + 4031 + } else if v == "4032" { + 4032 + } else if v == "4033" { + 4033 + } else if v == "4034" { + 4034 + } else if v == "4035" { + 4035 + } else if v == "4036" { + 4036 + } else if v == "4037" { + 4037 + } else if v == "4038" { + 4038 + } else if v == "4039" { + 4039 + } else if v == "4040" { + 4040 + } else if v == "4041" { + 4041 + } else if v == "4042" { + 4042 + } else if v == "4043" { + 4043 + } else if v == "4044" { + 4044 + } else if v == "4045" { + 4045 + } else if v == "4046" { + 4046 + } else if v == "4047" { + 4047 + } else if v == "4048" { + 4048 + } else if v == "4049" { + 4049 + } else if v == "4050" { + 4050 + } else if v == "4051" { + 4051 + } else if v == "4052" { + 4052 + } else if v == "4053" { + 4053 + } else if v == "4054" { + 4054 + } else if v == "4055" { + 4055 + } else if v == "4056" { + 4056 + } else if v == "4057" { + 4057 + } else if v == "4058" { + 4058 + } else if v == "4059" { + 4059 + } else if v == "4060" { + 4060 + } else if v == "4061" { + 4061 + } else if v == "4062" { + 4062 + } else if v == "4063" { + 4063 + } else if v == "4064" { + 4064 + } else if v == "4065" { + 4065 + } else if v == "4066" { + 4066 + } else if v == "4067" { + 4067 + } else if v == "4068" { + 4068 + } else if v == "4069" { + 4069 + } else if v == "4070" { + 4070 + } else if v == "4071" { + 4071 + } else if v == "4072" { + 4072 + } else if v == "4073" { + 4073 + } else if v == "4074" { + 4074 + } else if v == "4075" { + 4075 + } else if v == "4076" { + 4076 + } else if v == "4077" { + 4077 + } else if v == "4078" { + 4078 + } else if v == "4079" { + 4079 + } else if v == "4080" { + 4080 + } else if v == "4081" { + 4081 + } else if v == "4082" { + 4082 + } else if v == "4083" { + 4083 + } else if v == "4084" { + 4084 + } else if v == "4085" { + 4085 + } else if v == "4086" { + 4086 + } else if v == "4087" { + 4087 + } else if v == "4088" { + 4088 + } else if v == "4089" { + 4089 + } else if v == "4090" { + 4090 + } else if v == "4091" { + 4091 + } else if v == "4092" { + 4092 + } else if v == "4093" { + 4093 + } else if v == "4094" { + 4094 + } else if v == "4095" { + 4095 + } else if v == "4096" { + 4096 + } else if v == "4097" { + 4097 + } else if v == "4098" { + 4098 + } else if v == "4099" { + 4099 + } else if v == "4100" { + 4100 + } else if v == "4101" { + 4101 + } else if v == "4102" { + 4102 + } else if v == "4103" { + 4103 + } else if v == "4104" { + 4104 + } else if v == "4105" { + 4105 + } else if v == "4106" { + 4106 + } else if v == "4107" { + 4107 + } else if v == "4108" { + 4108 + } else if v == "4109" { + 4109 + } else if v == "4110" { + 4110 + } else if v == "4111" { + 4111 + } else if v == "4112" { + 4112 + } else if v == "4113" { + 4113 + } else if v == "4114" { + 4114 + } else if v == "4115" { + 4115 + } else if v == "4116" { + 4116 + } else if v == "4117" { + 4117 + } else if v == "4118" { + 4118 + } else if v == "4119" { + 4119 + } else if v == "4120" { + 4120 + } else if v == "4121" { + 4121 + } else if v == "4122" { + 4122 + } else if v == "4123" { + 4123 + } else if v == "4124" { + 4124 + } else if v == "4125" { + 4125 + } else if v == "4126" { + 4126 + } else if v == "4127" { + 4127 + } else if v == "4128" { + 4128 + } else if v == "4129" { + 4129 + } else if v == "4130" { + 4130 + } else if v == "4131" { + 4131 + } else if v == "4132" { + 4132 + } else if v == "4133" { + 4133 + } else if v == "4134" { + 4134 + } else if v == "4135" { + 4135 + } else if v == "4136" { + 4136 + } else if v == "4137" { + 4137 + } else if v == "4138" { + 4138 + } else if v == "4139" { + 4139 + } else if v == "4140" { + 4140 + } else if v == "4141" { + 4141 + } else if v == "4142" { + 4142 + } else if v == "4143" { + 4143 + } else if v == "4144" { + 4144 + } else if v == "4145" { + 4145 + } else if v == "4146" { + 4146 + } else if v == "4147" { + 4147 + } else if v == "4148" { + 4148 + } else if v == "4149" { + 4149 + } else if v == "4150" { + 4150 + } else if v == "4151" { + 4151 + } else if v == "4152" { + 4152 + } else if v == "4153" { + 4153 + } else if v == "4154" { + 4154 + } else if v == "4155" { + 4155 + } else if v == "4156" { + 4156 + } else if v == "4157" { + 4157 + } else if v == "4158" { + 4158 + } else if v == "4159" { + 4159 + } else if v == "4160" { + 4160 + } else if v == "4161" { + 4161 + } else if v == "4162" { + 4162 + } else if v == "4163" { + 4163 + } else if v == "4164" { + 4164 + } else if v == "4165" { + 4165 + } else if v == "4166" { + 4166 + } else if v == "4167" { + 4167 + } else if v == "4168" { + 4168 + } else if v == "4169" { + 4169 + } else if v == "4170" { + 4170 + } else if v == "4171" { + 4171 + } else if v == "4172" { + 4172 + } else if v == "4173" { + 4173 + } else if v == "4174" { + 4174 + } else if v == "4175" { + 4175 + } else if v == "4176" { + 4176 + } else if v == "4177" { + 4177 + } else if v == "4178" { + 4178 + } else if v == "4179" { + 4179 + } else if v == "4180" { + 4180 + } else if v == "4181" { + 4181 + } else if v == "4182" { + 4182 + } else if v == "4183" { + 4183 + } else if v == "4184" { + 4184 + } else if v == "4185" { + 4185 + } else if v == "4186" { + 4186 + } else if v == "4187" { + 4187 + } else if v == "4188" { + 4188 + } else if v == "4189" { + 4189 + } else if v == "4190" { + 4190 + } else if v == "4191" { + 4191 + } else if v == "4192" { + 4192 + } else if v == "4193" { + 4193 + } else if v == "4194" { + 4194 + } else if v == "4195" { + 4195 + } else if v == "4196" { + 4196 + } else if v == "4197" { + 4197 + } else if v == "4198" { + 4198 + } else if v == "4199" { + 4199 + } else if v == "4200" { + 4200 + } else if v == "4201" { + 4201 + } else if v == "4202" { + 4202 + } else if v == "4203" { + 4203 + } else if v == "4204" { + 4204 + } else if v == "4205" { + 4205 + } else if v == "4206" { + 4206 + } else if v == "4207" { + 4207 + } else if v == "4208" { + 4208 + } else if v == "4209" { + 4209 + } else if v == "4210" { + 4210 + } else if v == "4211" { + 4211 + } else if v == "4212" { + 4212 + } else if v == "4213" { + 4213 + } else if v == "4214" { + 4214 + } else if v == "4215" { + 4215 + } else if v == "4216" { + 4216 + } else if v == "4217" { + 4217 + } else if v == "4218" { + 4218 + } else if v == "4219" { + 4219 + } else if v == "4220" { + 4220 + } else if v == "4221" { + 4221 + } else if v == "4222" { + 4222 + } else if v == "4223" { + 4223 + } else if v == "4224" { + 4224 + } else if v == "4225" { + 4225 + } else if v == "4226" { + 4226 + } else if v == "4227" { + 4227 + } else if v == "4228" { + 4228 + } else if v == "4229" { + 4229 + } else if v == "4230" { + 4230 + } else if v == "4231" { + 4231 + } else if v == "4232" { + 4232 + } else if v == "4233" { + 4233 + } else if v == "4234" { + 4234 + } else if v == "4235" { + 4235 + } else if v == "4236" { + 4236 + } else if v == "4237" { + 4237 + } else if v == "4238" { + 4238 + } else if v == "4239" { + 4239 + } else if v == "4240" { + 4240 + } else if v == "4241" { + 4241 + } else if v == "4242" { + 4242 + } else if v == "4243" { + 4243 + } else if v == "4244" { + 4244 + } else if v == "4245" { + 4245 + } else if v == "4246" { + 4246 + } else if v == "4247" { + 4247 + } else if v == "4248" { + 4248 + } else if v == "4249" { + 4249 + } else if v == "4250" { + 4250 + } else if v == "4251" { + 4251 + } else if v == "4252" { + 4252 + } else if v == "4253" { + 4253 + } else if v == "4254" { + 4254 + } else if v == "4255" { + 4255 + } else if v == "4256" { + 4256 + } else if v == "4257" { + 4257 + } else if v == "4258" { + 4258 + } else if v == "4259" { + 4259 + } else if v == "4260" { + 4260 + } else if v == "4261" { + 4261 + } else if v == "4262" { + 4262 + } else if v == "4263" { + 4263 + } else if v == "4264" { + 4264 + } else if v == "4265" { + 4265 + } else if v == "4266" { + 4266 + } else if v == "4267" { + 4267 + } else if v == "4268" { + 4268 + } else if v == "4269" { + 4269 + } else if v == "4270" { + 4270 + } else if v == "4271" { + 4271 + } else if v == "4272" { + 4272 + } else if v == "4273" { + 4273 + } else if v == "4274" { + 4274 + } else if v == "4275" { + 4275 + } else if v == "4276" { + 4276 + } else if v == "4277" { + 4277 + } else if v == "4278" { + 4278 + } else if v == "4279" { + 4279 + } else if v == "4280" { + 4280 + } else if v == "4281" { + 4281 + } else if v == "4282" { + 4282 + } else if v == "4283" { + 4283 + } else if v == "4284" { + 4284 + } else if v == "4285" { + 4285 + } else if v == "4286" { + 4286 + } else if v == "4287" { + 4287 + } else if v == "4288" { + 4288 + } else if v == "4289" { + 4289 + } else if v == "4290" { + 4290 + } else if v == "4291" { + 4291 + } else if v == "4292" { + 4292 + } else if v == "4293" { + 4293 + } else if v == "4294" { + 4294 + } else if v == "4295" { + 4295 + } else if v == "4296" { + 4296 + } else if v == "4297" { + 4297 + } else if v == "4298" { + 4298 + } else if v == "4299" { + 4299 + } else if v == "4300" { + 4300 + } else if v == "4301" { + 4301 + } else if v == "4302" { + 4302 + } else if v == "4303" { + 4303 + } else if v == "4304" { + 4304 + } else if v == "4305" { + 4305 + } else if v == "4306" { + 4306 + } else if v == "4307" { + 4307 + } else if v == "4308" { + 4308 + } else if v == "4309" { + 4309 + } else if v == "4310" { + 4310 + } else if v == "4311" { + 4311 + } else if v == "4312" { + 4312 + } else if v == "4313" { + 4313 + } else if v == "4314" { + 4314 + } else if v == "4315" { + 4315 + } else if v == "4316" { + 4316 + } else if v == "4317" { + 4317 + } else if v == "4318" { + 4318 + } else if v == "4319" { + 4319 + } else if v == "4320" { + 4320 + } else if v == "4321" { + 4321 + } else if v == "4322" { + 4322 + } else if v == "4323" { + 4323 + } else if v == "4324" { + 4324 + } else if v == "4325" { + 4325 + } else if v == "4326" { + 4326 + } else if v == "4327" { + 4327 + } else if v == "4328" { + 4328 + } else if v == "4329" { + 4329 + } else if v == "4330" { + 4330 + } else if v == "4331" { + 4331 + } else if v == "4332" { + 4332 + } else if v == "4333" { + 4333 + } else if v == "4334" { + 4334 + } else if v == "4335" { + 4335 + } else if v == "4336" { + 4336 + } else if v == "4337" { + 4337 + } else if v == "4338" { + 4338 + } else if v == "4339" { + 4339 + } else if v == "4340" { + 4340 + } else if v == "4341" { + 4341 + } else if v == "4342" { + 4342 + } else if v == "4343" { + 4343 + } else if v == "4344" { + 4344 + } else if v == "4345" { + 4345 + } else if v == "4346" { + 4346 + } else if v == "4347" { + 4347 + } else if v == "4348" { + 4348 + } else if v == "4349" { + 4349 + } else if v == "4350" { + 4350 + } else if v == "4351" { + 4351 + } else if v == "4352" { + 4352 + } else if v == "4353" { + 4353 + } else if v == "4354" { + 4354 + } else if v == "4355" { + 4355 + } else if v == "4356" { + 4356 + } else if v == "4357" { + 4357 + } else if v == "4358" { + 4358 + } else if v == "4359" { + 4359 + } else if v == "4360" { + 4360 + } else if v == "4361" { + 4361 + } else if v == "4362" { + 4362 + } else if v == "4363" { + 4363 + } else if v == "4364" { + 4364 + } else if v == "4365" { + 4365 + } else if v == "4366" { + 4366 + } else if v == "4367" { + 4367 + } else if v == "4368" { + 4368 + } else if v == "4369" { + 4369 + } else if v == "4370" { + 4370 + } else if v == "4371" { + 4371 + } else if v == "4372" { + 4372 + } else if v == "4373" { + 4373 + } else if v == "4374" { + 4374 + } else if v == "4375" { + 4375 + } else if v == "4376" { + 4376 + } else if v == "4377" { + 4377 + } else if v == "4378" { + 4378 + } else if v == "4379" { + 4379 + } else if v == "4380" { + 4380 + } else if v == "4381" { + 4381 + } else if v == "4382" { + 4382 + } else if v == "4383" { + 4383 + } else if v == "4384" { + 4384 + } else if v == "4385" { + 4385 + } else if v == "4386" { + 4386 + } else if v == "4387" { + 4387 + } else if v == "4388" { + 4388 + } else if v == "4389" { + 4389 + } else if v == "4390" { + 4390 + } else if v == "4391" { + 4391 + } else if v == "4392" { + 4392 + } else if v == "4393" { + 4393 + } else if v == "4394" { + 4394 + } else if v == "4395" { + 4395 + } else if v == "4396" { + 4396 + } else if v == "4397" { + 4397 + } else if v == "4398" { + 4398 + } else if v == "4399" { + 4399 + } else if v == "4400" { + 4400 + } else if v == "4401" { + 4401 + } else if v == "4402" { + 4402 + } else if v == "4403" { + 4403 + } else if v == "4404" { + 4404 + } else if v == "4405" { + 4405 + } else if v == "4406" { + 4406 + } else if v == "4407" { + 4407 + } else if v == "4408" { + 4408 + } else if v == "4409" { + 4409 + } else if v == "4410" { + 4410 + } else if v == "4411" { + 4411 + } else if v == "4412" { + 4412 + } else if v == "4413" { + 4413 + } else if v == "4414" { + 4414 + } else if v == "4415" { + 4415 + } else if v == "4416" { + 4416 + } else if v == "4417" { + 4417 + } else if v == "4418" { + 4418 + } else if v == "4419" { + 4419 + } else if v == "4420" { + 4420 + } else if v == "4421" { + 4421 + } else if v == "4422" { + 4422 + } else if v == "4423" { + 4423 + } else if v == "4424" { + 4424 + } else if v == "4425" { + 4425 + } else if v == "4426" { + 4426 + } else if v == "4427" { + 4427 + } else if v == "4428" { + 4428 + } else if v == "4429" { + 4429 + } else if v == "4430" { + 4430 + } else if v == "4431" { + 4431 + } else if v == "4432" { + 4432 + } else if v == "4433" { + 4433 + } else if v == "4434" { + 4434 + } else if v == "4435" { + 4435 + } else if v == "4436" { + 4436 + } else if v == "4437" { + 4437 + } else if v == "4438" { + 4438 + } else if v == "4439" { + 4439 + } else if v == "4440" { + 4440 + } else if v == "4441" { + 4441 + } else if v == "4442" { + 4442 + } else if v == "4443" { + 4443 + } else if v == "4444" { + 4444 + } else if v == "4445" { + 4445 + } else if v == "4446" { + 4446 + } else if v == "4447" { + 4447 + } else if v == "4448" { + 4448 + } else if v == "4449" { + 4449 + } else if v == "4450" { + 4450 + } else if v == "4451" { + 4451 + } else if v == "4452" { + 4452 + } else if v == "4453" { + 4453 + } else if v == "4454" { + 4454 + } else if v == "4455" { + 4455 + } else if v == "4456" { + 4456 + } else if v == "4457" { + 4457 + } else if v == "4458" { + 4458 + } else if v == "4459" { + 4459 + } else if v == "4460" { + 4460 + } else if v == "4461" { + 4461 + } else if v == "4462" { + 4462 + } else if v == "4463" { + 4463 + } else if v == "4464" { + 4464 + } else if v == "4465" { + 4465 + } else if v == "4466" { + 4466 + } else if v == "4467" { + 4467 + } else if v == "4468" { + 4468 + } else if v == "4469" { + 4469 + } else if v == "4470" { + 4470 + } else if v == "4471" { + 4471 + } else if v == "4472" { + 4472 + } else if v == "4473" { + 4473 + } else if v == "4474" { + 4474 + } else if v == "4475" { + 4475 + } else if v == "4476" { + 4476 + } else if v == "4477" { + 4477 + } else if v == "4478" { + 4478 + } else if v == "4479" { + 4479 + } else if v == "4480" { + 4480 + } else if v == "4481" { + 4481 + } else if v == "4482" { + 4482 + } else if v == "4483" { + 4483 + } else if v == "4484" { + 4484 + } else if v == "4485" { + 4485 + } else if v == "4486" { + 4486 + } else if v == "4487" { + 4487 + } else if v == "4488" { + 4488 + } else if v == "4489" { + 4489 + } else if v == "4490" { + 4490 + } else if v == "4491" { + 4491 + } else if v == "4492" { + 4492 + } else if v == "4493" { + 4493 + } else if v == "4494" { + 4494 + } else if v == "4495" { + 4495 + } else if v == "4496" { + 4496 + } else if v == "4497" { + 4497 + } else if v == "4498" { + 4498 + } else if v == "4499" { + 4499 + } else if v == "4500" { + 4500 + } else if v == "4501" { + 4501 + } else if v == "4502" { + 4502 + } else if v == "4503" { + 4503 + } else if v == "4504" { + 4504 + } else if v == "4505" { + 4505 + } else if v == "4506" { + 4506 + } else if v == "4507" { + 4507 + } else if v == "4508" { + 4508 + } else if v == "4509" { + 4509 + } else if v == "4510" { + 4510 + } else if v == "4511" { + 4511 + } else if v == "4512" { + 4512 + } else if v == "4513" { + 4513 + } else if v == "4514" { + 4514 + } else if v == "4515" { + 4515 + } else if v == "4516" { + 4516 + } else if v == "4517" { + 4517 + } else if v == "4518" { + 4518 + } else if v == "4519" { + 4519 + } else if v == "4520" { + 4520 + } else if v == "4521" { + 4521 + } else if v == "4522" { + 4522 + } else if v == "4523" { + 4523 + } else if v == "4524" { + 4524 + } else if v == "4525" { + 4525 + } else if v == "4526" { + 4526 + } else if v == "4527" { + 4527 + } else if v == "4528" { + 4528 + } else if v == "4529" { + 4529 + } else if v == "4530" { + 4530 + } else if v == "4531" { + 4531 + } else if v == "4532" { + 4532 + } else if v == "4533" { + 4533 + } else if v == "4534" { + 4534 + } else if v == "4535" { + 4535 + } else if v == "4536" { + 4536 + } else if v == "4537" { + 4537 + } else if v == "4538" { + 4538 + } else if v == "4539" { + 4539 + } else if v == "4540" { + 4540 + } else if v == "4541" { + 4541 + } else if v == "4542" { + 4542 + } else if v == "4543" { + 4543 + } else if v == "4544" { + 4544 + } else if v == "4545" { + 4545 + } else if v == "4546" { + 4546 + } else if v == "4547" { + 4547 + } else if v == "4548" { + 4548 + } else if v == "4549" { + 4549 + } else if v == "4550" { + 4550 + } else if v == "4551" { + 4551 + } else if v == "4552" { + 4552 + } else if v == "4553" { + 4553 + } else if v == "4554" { + 4554 + } else if v == "4555" { + 4555 + } else if v == "4556" { + 4556 + } else if v == "4557" { + 4557 + } else if v == "4558" { + 4558 + } else if v == "4559" { + 4559 + } else if v == "4560" { + 4560 + } else if v == "4561" { + 4561 + } else if v == "4562" { + 4562 + } else if v == "4563" { + 4563 + } else if v == "4564" { + 4564 + } else if v == "4565" { + 4565 + } else if v == "4566" { + 4566 + } else if v == "4567" { + 4567 + } else if v == "4568" { + 4568 + } else if v == "4569" { + 4569 + } else if v == "4570" { + 4570 + } else if v == "4571" { + 4571 + } else if v == "4572" { + 4572 + } else if v == "4573" { + 4573 + } else if v == "4574" { + 4574 + } else if v == "4575" { + 4575 + } else if v == "4576" { + 4576 + } else if v == "4577" { + 4577 + } else if v == "4578" { + 4578 + } else if v == "4579" { + 4579 + } else if v == "4580" { + 4580 + } else if v == "4581" { + 4581 + } else if v == "4582" { + 4582 + } else if v == "4583" { + 4583 + } else if v == "4584" { + 4584 + } else if v == "4585" { + 4585 + } else if v == "4586" { + 4586 + } else if v == "4587" { + 4587 + } else if v == "4588" { + 4588 + } else if v == "4589" { + 4589 + } else if v == "4590" { + 4590 + } else if v == "4591" { + 4591 + } else if v == "4592" { + 4592 + } else if v == "4593" { + 4593 + } else if v == "4594" { + 4594 + } else if v == "4595" { + 4595 + } else if v == "4596" { + 4596 + } else if v == "4597" { + 4597 + } else if v == "4598" { + 4598 + } else if v == "4599" { + 4599 + } else if v == "4600" { + 4600 + } else if v == "4601" { + 4601 + } else if v == "4602" { + 4602 + } else if v == "4603" { + 4603 + } else if v == "4604" { + 4604 + } else if v == "4605" { + 4605 + } else if v == "4606" { + 4606 + } else if v == "4607" { + 4607 + } else if v == "4608" { + 4608 + } else if v == "4609" { + 4609 + } else if v == "4610" { + 4610 + } else if v == "4611" { + 4611 + } else if v == "4612" { + 4612 + } else if v == "4613" { + 4613 + } else if v == "4614" { + 4614 + } else if v == "4615" { + 4615 + } else if v == "4616" { + 4616 + } else if v == "4617" { + 4617 + } else if v == "4618" { + 4618 + } else if v == "4619" { + 4619 + } else if v == "4620" { + 4620 + } else if v == "4621" { + 4621 + } else if v == "4622" { + 4622 + } else if v == "4623" { + 4623 + } else if v == "4624" { + 4624 + } else if v == "4625" { + 4625 + } else if v == "4626" { + 4626 + } else if v == "4627" { + 4627 + } else if v == "4628" { + 4628 + } else if v == "4629" { + 4629 + } else if v == "4630" { + 4630 + } else if v == "4631" { + 4631 + } else if v == "4632" { + 4632 + } else if v == "4633" { + 4633 + } else if v == "4634" { + 4634 + } else if v == "4635" { + 4635 + } else if v == "4636" { + 4636 + } else if v == "4637" { + 4637 + } else if v == "4638" { + 4638 + } else if v == "4639" { + 4639 + } else if v == "4640" { + 4640 + } else if v == "4641" { + 4641 + } else if v == "4642" { + 4642 + } else if v == "4643" { + 4643 + } else if v == "4644" { + 4644 + } else if v == "4645" { + 4645 + } else if v == "4646" { + 4646 + } else if v == "4647" { + 4647 + } else if v == "4648" { + 4648 + } else if v == "4649" { + 4649 + } else if v == "4650" { + 4650 + } else if v == "4651" { + 4651 + } else if v == "4652" { + 4652 + } else if v == "4653" { + 4653 + } else if v == "4654" { + 4654 + } else if v == "4655" { + 4655 + } else if v == "4656" { + 4656 + } else if v == "4657" { + 4657 + } else if v == "4658" { + 4658 + } else if v == "4659" { + 4659 + } else if v == "4660" { + 4660 + } else if v == "4661" { + 4661 + } else if v == "4662" { + 4662 + } else if v == "4663" { + 4663 + } else if v == "4664" { + 4664 + } else if v == "4665" { + 4665 + } else if v == "4666" { + 4666 + } else if v == "4667" { + 4667 + } else if v == "4668" { + 4668 + } else if v == "4669" { + 4669 + } else if v == "4670" { + 4670 + } else if v == "4671" { + 4671 + } else if v == "4672" { + 4672 + } else if v == "4673" { + 4673 + } else if v == "4674" { + 4674 + } else if v == "4675" { + 4675 + } else if v == "4676" { + 4676 + } else if v == "4677" { + 4677 + } else if v == "4678" { + 4678 + } else if v == "4679" { + 4679 + } else if v == "4680" { + 4680 + } else if v == "4681" { + 4681 + } else if v == "4682" { + 4682 + } else if v == "4683" { + 4683 + } else if v == "4684" { + 4684 + } else if v == "4685" { + 4685 + } else if v == "4686" { + 4686 + } else if v == "4687" { + 4687 + } else if v == "4688" { + 4688 + } else if v == "4689" { + 4689 + } else if v == "4690" { + 4690 + } else if v == "4691" { + 4691 + } else if v == "4692" { + 4692 + } else if v == "4693" { + 4693 + } else if v == "4694" { + 4694 + } else if v == "4695" { + 4695 + } else if v == "4696" { + 4696 + } else if v == "4697" { + 4697 + } else if v == "4698" { + 4698 + } else if v == "4699" { + 4699 + } else if v == "4700" { + 4700 + } else if v == "4701" { + 4701 + } else if v == "4702" { + 4702 + } else if v == "4703" { + 4703 + } else if v == "4704" { + 4704 + } else if v == "4705" { + 4705 + } else if v == "4706" { + 4706 + } else if v == "4707" { + 4707 + } else if v == "4708" { + 4708 + } else if v == "4709" { + 4709 + } else if v == "4710" { + 4710 + } else if v == "4711" { + 4711 + } else if v == "4712" { + 4712 + } else if v == "4713" { + 4713 + } else if v == "4714" { + 4714 + } else if v == "4715" { + 4715 + } else if v == "4716" { + 4716 + } else if v == "4717" { + 4717 + } else if v == "4718" { + 4718 + } else if v == "4719" { + 4719 + } else if v == "4720" { + 4720 + } else if v == "4721" { + 4721 + } else if v == "4722" { + 4722 + } else if v == "4723" { + 4723 + } else if v == "4724" { + 4724 + } else if v == "4725" { + 4725 + } else if v == "4726" { + 4726 + } else if v == "4727" { + 4727 + } else if v == "4728" { + 4728 + } else if v == "4729" { + 4729 + } else if v == "4730" { + 4730 + } else if v == "4731" { + 4731 + } else if v == "4732" { + 4732 + } else if v == "4733" { + 4733 + } else if v == "4734" { + 4734 + } else if v == "4735" { + 4735 + } else if v == "4736" { + 4736 + } else if v == "4737" { + 4737 + } else if v == "4738" { + 4738 + } else if v == "4739" { + 4739 + } else if v == "4740" { + 4740 + } else if v == "4741" { + 4741 + } else if v == "4742" { + 4742 + } else if v == "4743" { + 4743 + } else if v == "4744" { + 4744 + } else if v == "4745" { + 4745 + } else if v == "4746" { + 4746 + } else if v == "4747" { + 4747 + } else if v == "4748" { + 4748 + } else if v == "4749" { + 4749 + } else if v == "4750" { + 4750 + } else if v == "4751" { + 4751 + } else if v == "4752" { + 4752 + } else if v == "4753" { + 4753 + } else if v == "4754" { + 4754 + } else if v == "4755" { + 4755 + } else if v == "4756" { + 4756 + } else if v == "4757" { + 4757 + } else if v == "4758" { + 4758 + } else if v == "4759" { + 4759 + } else if v == "4760" { + 4760 + } else if v == "4761" { + 4761 + } else if v == "4762" { + 4762 + } else if v == "4763" { + 4763 + } else if v == "4764" { + 4764 + } else if v == "4765" { + 4765 + } else if v == "4766" { + 4766 + } else if v == "4767" { + 4767 + } else if v == "4768" { + 4768 + } else if v == "4769" { + 4769 + } else if v == "4770" { + 4770 + } else if v == "4771" { + 4771 + } else if v == "4772" { + 4772 + } else if v == "4773" { + 4773 + } else if v == "4774" { + 4774 + } else if v == "4775" { + 4775 + } else if v == "4776" { + 4776 + } else if v == "4777" { + 4777 + } else if v == "4778" { + 4778 + } else if v == "4779" { + 4779 + } else if v == "4780" { + 4780 + } else if v == "4781" { + 4781 + } else if v == "4782" { + 4782 + } else if v == "4783" { + 4783 + } else if v == "4784" { + 4784 + } else if v == "4785" { + 4785 + } else if v == "4786" { + 4786 + } else if v == "4787" { + 4787 + } else if v == "4788" { + 4788 + } else if v == "4789" { + 4789 + } else if v == "4790" { + 4790 + } else if v == "4791" { + 4791 + } else if v == "4792" { + 4792 + } else if v == "4793" { + 4793 + } else if v == "4794" { + 4794 + } else if v == "4795" { + 4795 + } else if v == "4796" { + 4796 + } else if v == "4797" { + 4797 + } else if v == "4798" { + 4798 + } else if v == "4799" { + 4799 + } else if v == "4800" { + 4800 + } else if v == "4801" { + 4801 + } else if v == "4802" { + 4802 + } else if v == "4803" { + 4803 + } else if v == "4804" { + 4804 + } else if v == "4805" { + 4805 + } else if v == "4806" { + 4806 + } else if v == "4807" { + 4807 + } else if v == "4808" { + 4808 + } else if v == "4809" { + 4809 + } else if v == "4810" { + 4810 + } else if v == "4811" { + 4811 + } else if v == "4812" { + 4812 + } else if v == "4813" { + 4813 + } else if v == "4814" { + 4814 + } else if v == "4815" { + 4815 + } else if v == "4816" { + 4816 + } else if v == "4817" { + 4817 + } else if v == "4818" { + 4818 + } else if v == "4819" { + 4819 + } else if v == "4820" { + 4820 + } else if v == "4821" { + 4821 + } else if v == "4822" { + 4822 + } else if v == "4823" { + 4823 + } else if v == "4824" { + 4824 + } else if v == "4825" { + 4825 + } else if v == "4826" { + 4826 + } else if v == "4827" { + 4827 + } else if v == "4828" { + 4828 + } else if v == "4829" { + 4829 + } else if v == "4830" { + 4830 + } else if v == "4831" { + 4831 + } else if v == "4832" { + 4832 + } else if v == "4833" { + 4833 + } else if v == "4834" { + 4834 + } else if v == "4835" { + 4835 + } else if v == "4836" { + 4836 + } else if v == "4837" { + 4837 + } else if v == "4838" { + 4838 + } else if v == "4839" { + 4839 + } else if v == "4840" { + 4840 + } else if v == "4841" { + 4841 + } else if v == "4842" { + 4842 + } else if v == "4843" { + 4843 + } else if v == "4844" { + 4844 + } else if v == "4845" { + 4845 + } else if v == "4846" { + 4846 + } else if v == "4847" { + 4847 + } else if v == "4848" { + 4848 + } else if v == "4849" { + 4849 + } else if v == "4850" { + 4850 + } else if v == "4851" { + 4851 + } else if v == "4852" { + 4852 + } else if v == "4853" { + 4853 + } else if v == "4854" { + 4854 + } else if v == "4855" { + 4855 + } else if v == "4856" { + 4856 + } else if v == "4857" { + 4857 + } else if v == "4858" { + 4858 + } else if v == "4859" { + 4859 + } else if v == "4860" { + 4860 + } else if v == "4861" { + 4861 + } else if v == "4862" { + 4862 + } else if v == "4863" { + 4863 + } else if v == "4864" { + 4864 + } else if v == "4865" { + 4865 + } else if v == "4866" { + 4866 + } else if v == "4867" { + 4867 + } else if v == "4868" { + 4868 + } else if v == "4869" { + 4869 + } else if v == "4870" { + 4870 + } else if v == "4871" { + 4871 + } else if v == "4872" { + 4872 + } else if v == "4873" { + 4873 + } else if v == "4874" { + 4874 + } else if v == "4875" { + 4875 + } else if v == "4876" { + 4876 + } else if v == "4877" { + 4877 + } else if v == "4878" { + 4878 + } else if v == "4879" { + 4879 + } else if v == "4880" { + 4880 + } else if v == "4881" { + 4881 + } else if v == "4882" { + 4882 + } else if v == "4883" { + 4883 + } else if v == "4884" { + 4884 + } else if v == "4885" { + 4885 + } else if v == "4886" { + 4886 + } else if v == "4887" { + 4887 + } else if v == "4888" { + 4888 + } else if v == "4889" { + 4889 + } else if v == "4890" { + 4890 + } else if v == "4891" { + 4891 + } else if v == "4892" { + 4892 + } else if v == "4893" { + 4893 + } else if v == "4894" { + 4894 + } else if v == "4895" { + 4895 + } else if v == "4896" { + 4896 + } else if v == "4897" { + 4897 + } else if v == "4898" { + 4898 + } else if v == "4899" { + 4899 + } else if v == "4900" { + 4900 + } else if v == "4901" { + 4901 + } else if v == "4902" { + 4902 + } else if v == "4903" { + 4903 + } else if v == "4904" { + 4904 + } else if v == "4905" { + 4905 + } else if v == "4906" { + 4906 + } else if v == "4907" { + 4907 + } else if v == "4908" { + 4908 + } else if v == "4909" { + 4909 + } else if v == "4910" { + 4910 + } else if v == "4911" { + 4911 + } else if v == "4912" { + 4912 + } else if v == "4913" { + 4913 + } else if v == "4914" { + 4914 + } else if v == "4915" { + 4915 + } else if v == "4916" { + 4916 + } else if v == "4917" { + 4917 + } else if v == "4918" { + 4918 + } else if v == "4919" { + 4919 + } else if v == "4920" { + 4920 + } else if v == "4921" { + 4921 + } else if v == "4922" { + 4922 + } else if v == "4923" { + 4923 + } else if v == "4924" { + 4924 + } else if v == "4925" { + 4925 + } else if v == "4926" { + 4926 + } else if v == "4927" { + 4927 + } else if v == "4928" { + 4928 + } else if v == "4929" { + 4929 + } else if v == "4930" { + 4930 + } else if v == "4931" { + 4931 + } else if v == "4932" { + 4932 + } else if v == "4933" { + 4933 + } else if v == "4934" { + 4934 + } else if v == "4935" { + 4935 + } else if v == "4936" { + 4936 + } else if v == "4937" { + 4937 + } else if v == "4938" { + 4938 + } else if v == "4939" { + 4939 + } else if v == "4940" { + 4940 + } else if v == "4941" { + 4941 + } else if v == "4942" { + 4942 + } else if v == "4943" { + 4943 + } else if v == "4944" { + 4944 + } else if v == "4945" { + 4945 + } else if v == "4946" { + 4946 + } else if v == "4947" { + 4947 + } else if v == "4948" { + 4948 + } else if v == "4949" { + 4949 + } else if v == "4950" { + 4950 + } else if v == "4951" { + 4951 + } else if v == "4952" { + 4952 + } else if v == "4953" { + 4953 + } else if v == "4954" { + 4954 + } else if v == "4955" { + 4955 + } else if v == "4956" { + 4956 + } else if v == "4957" { + 4957 + } else if v == "4958" { + 4958 + } else if v == "4959" { + 4959 + } else if v == "4960" { + 4960 + } else if v == "4961" { + 4961 + } else if v == "4962" { + 4962 + } else if v == "4963" { + 4963 + } else if v == "4964" { + 4964 + } else if v == "4965" { + 4965 + } else if v == "4966" { + 4966 + } else if v == "4967" { + 4967 + } else if v == "4968" { + 4968 + } else if v == "4969" { + 4969 + } else if v == "4970" { + 4970 + } else if v == "4971" { + 4971 + } else if v == "4972" { + 4972 + } else if v == "4973" { + 4973 + } else if v == "4974" { + 4974 + } else if v == "4975" { + 4975 + } else if v == "4976" { + 4976 + } else if v == "4977" { + 4977 + } else if v == "4978" { + 4978 + } else if v == "4979" { + 4979 + } else if v == "4980" { + 4980 + } else if v == "4981" { + 4981 + } else if v == "4982" { + 4982 + } else if v == "4983" { + 4983 + } else if v == "4984" { + 4984 + } else if v == "4985" { + 4985 + } else if v == "4986" { + 4986 + } else if v == "4987" { + 4987 + } else if v == "4988" { + 4988 + } else if v == "4989" { + 4989 + } else if v == "4990" { + 4990 + } else if v == "4991" { + 4991 + } else if v == "4992" { + 4992 + } else if v == "4993" { + 4993 + } else if v == "4994" { + 4994 + } else if v == "4995" { + 4995 + } else if v == "4996" { + 4996 + } else if v == "4997" { + 4997 + } else if v == "4998" { + 4998 + } else if v == "4999" { + 4999 + } else if v == "5000" { + 5000 + } else if v == "5001" { + 5001 + } else if v == "5002" { + 5002 + } else if v == "5003" { + 5003 + } else if v == "5004" { + 5004 + } else if v == "5005" { + 5005 + } else if v == "5006" { + 5006 + } else if v == "5007" { + 5007 + } else if v == "5008" { + 5008 + } else if v == "5009" { + 5009 + } else if v == "5010" { + 5010 + } else if v == "5011" { + 5011 + } else if v == "5012" { + 5012 + } else if v == "5013" { + 5013 + } else if v == "5014" { + 5014 + } else if v == "5015" { + 5015 + } else if v == "5016" { + 5016 + } else if v == "5017" { + 5017 + } else if v == "5018" { + 5018 + } else if v == "5019" { + 5019 + } else if v == "5020" { + 5020 + } else if v == "5021" { + 5021 + } else if v == "5022" { + 5022 + } else if v == "5023" { + 5023 + } else if v == "5024" { + 5024 + } else if v == "5025" { + 5025 + } else if v == "5026" { + 5026 + } else if v == "5027" { + 5027 + } else if v == "5028" { + 5028 + } else if v == "5029" { + 5029 + } else if v == "5030" { + 5030 + } else if v == "5031" { + 5031 + } else if v == "5032" { + 5032 + } else if v == "5033" { + 5033 + } else if v == "5034" { + 5034 + } else if v == "5035" { + 5035 + } else if v == "5036" { + 5036 + } else if v == "5037" { + 5037 + } else if v == "5038" { + 5038 + } else if v == "5039" { + 5039 + } else if v == "5040" { + 5040 + } else if v == "5041" { + 5041 + } else if v == "5042" { + 5042 + } else if v == "5043" { + 5043 + } else if v == "5044" { + 5044 + } else if v == "5045" { + 5045 + } else if v == "5046" { + 5046 + } else if v == "5047" { + 5047 + } else if v == "5048" { + 5048 + } else if v == "5049" { + 5049 + } else if v == "5050" { + 5050 + } else if v == "5051" { + 5051 + } else if v == "5052" { + 5052 + } else if v == "5053" { + 5053 + } else if v == "5054" { + 5054 + } else if v == "5055" { + 5055 + } else if v == "5056" { + 5056 + } else if v == "5057" { + 5057 + } else if v == "5058" { + 5058 + } else if v == "5059" { + 5059 + } else if v == "5060" { + 5060 + } else if v == "5061" { + 5061 + } else if v == "5062" { + 5062 + } else if v == "5063" { + 5063 + } else if v == "5064" { + 5064 + } else if v == "5065" { + 5065 + } else if v == "5066" { + 5066 + } else if v == "5067" { + 5067 + } else if v == "5068" { + 5068 + } else if v == "5069" { + 5069 + } else if v == "5070" { + 5070 + } else if v == "5071" { + 5071 + } else if v == "5072" { + 5072 + } else if v == "5073" { + 5073 + } else if v == "5074" { + 5074 + } else if v == "5075" { + 5075 + } else if v == "5076" { + 5076 + } else if v == "5077" { + 5077 + } else if v == "5078" { + 5078 + } else if v == "5079" { + 5079 + } else if v == "5080" { + 5080 + } else if v == "5081" { + 5081 + } else if v == "5082" { + 5082 + } else if v == "5083" { + 5083 + } else if v == "5084" { + 5084 + } else if v == "5085" { + 5085 + } else if v == "5086" { + 5086 + } else if v == "5087" { + 5087 + } else if v == "5088" { + 5088 + } else if v == "5089" { + 5089 + } else if v == "5090" { + 5090 + } else if v == "5091" { + 5091 + } else if v == "5092" { + 5092 + } else if v == "5093" { + 5093 + } else if v == "5094" { + 5094 + } else if v == "5095" { + 5095 + } else if v == "5096" { + 5096 + } else if v == "5097" { + 5097 + } else if v == "5098" { + 5098 + } else if v == "5099" { + 5099 + } else if v == "5100" { + 5100 + } else if v == "5101" { + 5101 + } else if v == "5102" { + 5102 + } else if v == "5103" { + 5103 + } else if v == "5104" { + 5104 + } else if v == "5105" { + 5105 + } else if v == "5106" { + 5106 + } else if v == "5107" { + 5107 + } else if v == "5108" { + 5108 + } else if v == "5109" { + 5109 + } else if v == "5110" { + 5110 + } else if v == "5111" { + 5111 + } else if v == "5112" { + 5112 + } else if v == "5113" { + 5113 + } else if v == "5114" { + 5114 + } else if v == "5115" { + 5115 + } else if v == "5116" { + 5116 + } else if v == "5117" { + 5117 + } else if v == "5118" { + 5118 + } else if v == "5119" { + 5119 + } else if v == "5120" { + 5120 + } else if v == "5121" { + 5121 + } else if v == "5122" { + 5122 + } else if v == "5123" { + 5123 + } else if v == "5124" { + 5124 + } else if v == "5125" { + 5125 + } else if v == "5126" { + 5126 + } else if v == "5127" { + 5127 + } else if v == "5128" { + 5128 + } else if v == "5129" { + 5129 + } else if v == "5130" { + 5130 + } else if v == "5131" { + 5131 + } else if v == "5132" { + 5132 + } else if v == "5133" { + 5133 + } else if v == "5134" { + 5134 + } else if v == "5135" { + 5135 + } else if v == "5136" { + 5136 + } else if v == "5137" { + 5137 + } else if v == "5138" { + 5138 + } else if v == "5139" { + 5139 + } else if v == "5140" { + 5140 + } else if v == "5141" { + 5141 + } else if v == "5142" { + 5142 + } else if v == "5143" { + 5143 + } else if v == "5144" { + 5144 + } else if v == "5145" { + 5145 + } else if v == "5146" { + 5146 + } else if v == "5147" { + 5147 + } else if v == "5148" { + 5148 + } else if v == "5149" { + 5149 + } else if v == "5150" { + 5150 + } else if v == "5151" { + 5151 + } else if v == "5152" { + 5152 + } else if v == "5153" { + 5153 + } else if v == "5154" { + 5154 + } else if v == "5155" { + 5155 + } else if v == "5156" { + 5156 + } else if v == "5157" { + 5157 + } else if v == "5158" { + 5158 + } else if v == "5159" { + 5159 + } else if v == "5160" { + 5160 + } else if v == "5161" { + 5161 + } else if v == "5162" { + 5162 + } else if v == "5163" { + 5163 + } else if v == "5164" { + 5164 + } else if v == "5165" { + 5165 + } else if v == "5166" { + 5166 + } else if v == "5167" { + 5167 + } else if v == "5168" { + 5168 + } else if v == "5169" { + 5169 + } else if v == "5170" { + 5170 + } else if v == "5171" { + 5171 + } else if v == "5172" { + 5172 + } else if v == "5173" { + 5173 + } else if v == "5174" { + 5174 + } else if v == "5175" { + 5175 + } else if v == "5176" { + 5176 + } else if v == "5177" { + 5177 + } else if v == "5178" { + 5178 + } else if v == "5179" { + 5179 + } else if v == "5180" { + 5180 + } else if v == "5181" { + 5181 + } else if v == "5182" { + 5182 + } else if v == "5183" { + 5183 + } else if v == "5184" { + 5184 + } else if v == "5185" { + 5185 + } else if v == "5186" { + 5186 + } else if v == "5187" { + 5187 + } else if v == "5188" { + 5188 + } else if v == "5189" { + 5189 + } else if v == "5190" { + 5190 + } else if v == "5191" { + 5191 + } else if v == "5192" { + 5192 + } else if v == "5193" { + 5193 + } else if v == "5194" { + 5194 + } else if v == "5195" { + 5195 + } else if v == "5196" { + 5196 + } else if v == "5197" { + 5197 + } else if v == "5198" { + 5198 + } else if v == "5199" { + 5199 + } else if v == "5200" { + 5200 + } else if v == "5201" { + 5201 + } else if v == "5202" { + 5202 + } else if v == "5203" { + 5203 + } else if v == "5204" { + 5204 + } else if v == "5205" { + 5205 + } else { + 5206 + } +} diff --git a/tests/ui/issues/issue-7519-match-unit-in-arg.rs b/tests/ui/issues/issue-7519-match-unit-in-arg.rs new file mode 100644 index 000000000..7d838cbb0 --- /dev/null +++ b/tests/ui/issues/issue-7519-match-unit-in-arg.rs @@ -0,0 +1,12 @@ +// run-pass +// pretty-expanded FIXME #23616 + +/* +#7519 ICE pattern matching unit in function argument +*/ + +fn foo(():()) { } + +pub fn main() { + foo(()); +} diff --git a/tests/ui/issues/issue-75283.rs b/tests/ui/issues/issue-75283.rs new file mode 100644 index 000000000..d556132e4 --- /dev/null +++ b/tests/ui/issues/issue-75283.rs @@ -0,0 +1,6 @@ +extern "C" { + fn lol() { //~ ERROR incorrect function inside `extern` block + println!(""); + } +} +fn main() {} diff --git a/tests/ui/issues/issue-75283.stderr b/tests/ui/issues/issue-75283.stderr new file mode 100644 index 000000000..da3800aff --- /dev/null +++ b/tests/ui/issues/issue-75283.stderr @@ -0,0 +1,18 @@ +error: incorrect function inside `extern` block + --> $DIR/issue-75283.rs:2:8 + | +LL | extern "C" { + | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | fn lol() { + | ________^^^___- + | | | + | | cannot have a body +LL | | println!(""); +LL | | } + | |_____- help: remove the invalid body: `;` + | + = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block + = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-75307.rs b/tests/ui/issues/issue-75307.rs new file mode 100644 index 000000000..cffa6bea8 --- /dev/null +++ b/tests/ui/issues/issue-75307.rs @@ -0,0 +1,3 @@ +fn main() { + format!(r"{}{}{}", named_arg=1); //~ ERROR 3 positional arguments in format string, but there is 1 argument +} diff --git a/tests/ui/issues/issue-75307.stderr b/tests/ui/issues/issue-75307.stderr new file mode 100644 index 000000000..c5b0b11e7 --- /dev/null +++ b/tests/ui/issues/issue-75307.stderr @@ -0,0 +1,8 @@ +error: 3 positional arguments in format string, but there is 1 argument + --> $DIR/issue-75307.rs:2:15 + | +LL | format!(r"{}{}{}", named_arg=1); + | ^^^^^^ - + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-7563.rs b/tests/ui/issues/issue-7563.rs new file mode 100644 index 000000000..c62405554 --- /dev/null +++ b/tests/ui/issues/issue-7563.rs @@ -0,0 +1,28 @@ +// run-pass +#![allow(dead_code)] +trait IDummy { + fn do_nothing(&self); +} + +#[derive(Debug)] +struct A { a: isize } +#[derive(Debug)] +struct B<'a> { b: isize, pa: &'a A } + + impl IDummy for A { + fn do_nothing(&self) { + println!("A::do_nothing() is called"); + } + } + +impl<'a> B<'a> { + fn get_pa(&self) -> &'a dyn IDummy { self.pa as &'a dyn IDummy } +} + +pub fn main() { + let sa = A { a: 100 }; + let sb = B { b: 200, pa: &sa }; + + println!("sa is {:?}", sa); + println!("sb is {:?}", sb); +} diff --git a/tests/ui/issues/issue-75704.rs b/tests/ui/issues/issue-75704.rs new file mode 100644 index 000000000..aed7ddbcb --- /dev/null +++ b/tests/ui/issues/issue-75704.rs @@ -0,0 +1,7 @@ +// Caused an infinite loop during SimlifyCfg MIR transform previously. +// +// build-pass + +fn main() { + loop { continue; } +} diff --git a/tests/ui/issues/issue-7575.rs b/tests/ui/issues/issue-7575.rs new file mode 100644 index 000000000..ac69f2b1c --- /dev/null +++ b/tests/ui/issues/issue-7575.rs @@ -0,0 +1,17 @@ +// run-pass + +trait Foo { + fn new() -> bool { false } + fn dummy(&self) { } +} + +trait Bar { + fn new(&self) -> bool { true } +} + +impl Bar for isize {} +impl Foo for isize {} + +fn main() { + assert!(1.new()); +} diff --git a/tests/ui/issues/issue-75777.rs b/tests/ui/issues/issue-75777.rs new file mode 100644 index 000000000..a1e438bc6 --- /dev/null +++ b/tests/ui/issues/issue-75777.rs @@ -0,0 +1,15 @@ +// Regression test for #75777. +// Checks that a boxed future can be properly constructed. + +use std::future::{self, Future}; +use std::pin::Pin; + +type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a + Send>>; + +fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> { + let fut: BoxFuture<'a, A> = Box::pin(future::ready(v)); + Box::new(move |_| fut) + //~^ ERROR: lifetime may not live long enough +} + +fn main() {} diff --git a/tests/ui/issues/issue-75777.stderr b/tests/ui/issues/issue-75777.stderr new file mode 100644 index 000000000..370cd72fd --- /dev/null +++ b/tests/ui/issues/issue-75777.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-75777.rs:11:5 + | +LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> { + | -- lifetime `'a` defined here +LL | let fut: BoxFuture<'a, A> = Box::pin(future::ready(v)); +LL | Box::new(move |_| fut) + | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-76042.rs b/tests/ui/issues/issue-76042.rs new file mode 100644 index 000000000..34d529379 --- /dev/null +++ b/tests/ui/issues/issue-76042.rs @@ -0,0 +1,16 @@ +// run-pass +// compile-flags: -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=0 + +fn foo(a: i128, b: i128, s: u32) -> (i128, i128) { + if s == 128 { + (0, 0) + } else { + (b >> s, a >> s) + } +} +fn main() { + let r = foo(0, 8, 1); + if r.0 != 4 { + panic!(); + } +} diff --git a/tests/ui/issues/issue-7607-1.rs b/tests/ui/issues/issue-7607-1.rs new file mode 100644 index 000000000..5221f2c52 --- /dev/null +++ b/tests/ui/issues/issue-7607-1.rs @@ -0,0 +1,9 @@ +struct Foo { + x: isize +} + +impl Fo { //~ ERROR cannot find type `Fo` in this scope + fn foo() {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-7607-1.stderr b/tests/ui/issues/issue-7607-1.stderr new file mode 100644 index 000000000..c98302699 --- /dev/null +++ b/tests/ui/issues/issue-7607-1.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `Fo` in this scope + --> $DIR/issue-7607-1.rs:5:6 + | +LL | impl Fo { + | ^^ help: a trait with a similar name exists: `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL + | + = note: similarly named trait `Fn` defined here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-7607-2.rs b/tests/ui/issues/issue-7607-2.rs new file mode 100644 index 000000000..420a0ffd3 --- /dev/null +++ b/tests/ui/issues/issue-7607-2.rs @@ -0,0 +1,16 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub mod a { + pub struct Foo { a: usize } +} + +pub mod b { + use a::Foo; + impl Foo { + fn bar(&self) { } + } +} + +pub fn main() { } diff --git a/tests/ui/issues/issue-76077-1.fixed b/tests/ui/issues/issue-76077-1.fixed new file mode 100644 index 000000000..8103a7ca4 --- /dev/null +++ b/tests/ui/issues/issue-76077-1.fixed @@ -0,0 +1,18 @@ +// run-rustfix +#![allow(dead_code, unused_variables)] + +pub mod foo { + #[derive(Default)] + pub struct Foo { invisible: bool, } + + #[derive(Default)] + pub struct Bar { pub visible: bool, invisible: bool, } +} + +fn main() { + let foo::Foo { .. } = foo::Foo::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields + + let foo::Bar { visible, .. } = foo::Bar::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields +} diff --git a/tests/ui/issues/issue-76077-1.rs b/tests/ui/issues/issue-76077-1.rs new file mode 100644 index 000000000..730332853 --- /dev/null +++ b/tests/ui/issues/issue-76077-1.rs @@ -0,0 +1,18 @@ +// run-rustfix +#![allow(dead_code, unused_variables)] + +pub mod foo { + #[derive(Default)] + pub struct Foo { invisible: bool, } + + #[derive(Default)] + pub struct Bar { pub visible: bool, invisible: bool, } +} + +fn main() { + let foo::Foo {} = foo::Foo::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields + + let foo::Bar { visible } = foo::Bar::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields +} diff --git a/tests/ui/issues/issue-76077-1.stderr b/tests/ui/issues/issue-76077-1.stderr new file mode 100644 index 000000000..8e77662b4 --- /dev/null +++ b/tests/ui/issues/issue-76077-1.stderr @@ -0,0 +1,24 @@ +error: pattern requires `..` due to inaccessible fields + --> $DIR/issue-76077-1.rs:13:9 + | +LL | let foo::Foo {} = foo::Foo::default(); + | ^^^^^^^^^^^ + | +help: ignore the inaccessible and unused fields + | +LL | let foo::Foo { .. } = foo::Foo::default(); + | ~~~~~~ + +error: pattern requires `..` due to inaccessible fields + --> $DIR/issue-76077-1.rs:16:9 + | +LL | let foo::Bar { visible } = foo::Bar::default(); + | ^^^^^^^^^^^^^^^^^^^^ + | +help: ignore the inaccessible and unused fields + | +LL | let foo::Bar { visible, .. } = foo::Bar::default(); + | ++++ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-76077.rs b/tests/ui/issues/issue-76077.rs new file mode 100644 index 000000000..2d29093b0 --- /dev/null +++ b/tests/ui/issues/issue-76077.rs @@ -0,0 +1,10 @@ +pub mod foo { + pub struct Foo { + you_cant_use_this_field: bool, + } +} + +fn main() { + foo::Foo {}; + //~^ ERROR cannot construct `Foo` with struct literal syntax due to private fields +} diff --git a/tests/ui/issues/issue-76077.stderr b/tests/ui/issues/issue-76077.stderr new file mode 100644 index 000000000..197ca8d5a --- /dev/null +++ b/tests/ui/issues/issue-76077.stderr @@ -0,0 +1,10 @@ +error: cannot construct `Foo` with struct literal syntax due to private fields + --> $DIR/issue-76077.rs:8:5 + | +LL | foo::Foo {}; + | ^^^^^^^^ + | + = note: ... and other private field `you_cant_use_this_field` that was not provided + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-76191.rs b/tests/ui/issues/issue-76191.rs new file mode 100644 index 000000000..d9790d2b5 --- /dev/null +++ b/tests/ui/issues/issue-76191.rs @@ -0,0 +1,19 @@ +// Regression test for diagnostic issue #76191 +#![allow(non_snake_case)] + +use std::ops::RangeInclusive; + +const RANGE: RangeInclusive<i32> = 0..=255; + +const RANGE2: RangeInclusive<i32> = panic!(); + +fn main() { + let n: i32 = 1; + match n { + RANGE => {} + //~^ ERROR mismatched types + RANGE2 => {} + //~^ ERROR mismatched types + _ => {} + } +} diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr new file mode 100644 index 000000000..137498047 --- /dev/null +++ b/tests/ui/issues/issue-76191.stderr @@ -0,0 +1,43 @@ +error[E0308]: mismatched types + --> $DIR/issue-76191.rs:13:9 + | +LL | const RANGE: RangeInclusive<i32> = 0..=255; + | -------------------------------- constant defined here +... +LL | match n { + | - this expression has type `i32` +LL | RANGE => {} + | ^^^^^ + | | + | expected `i32`, found struct `RangeInclusive` + | `RANGE` is interpreted as a constant, not a new binding + | + = note: expected type `i32` + found struct `RangeInclusive<i32>` +help: you may want to move the range into the match block + | +LL | 0..=255 => {} + | ~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/issue-76191.rs:15:9 + | +LL | const RANGE2: RangeInclusive<i32> = panic!(); + | --------------------------------- constant defined here +... +LL | match n { + | - this expression has type `i32` +... +LL | RANGE2 => {} + | ^^^^^^ + | | + | expected `i32`, found struct `RangeInclusive` + | `RANGE2` is interpreted as a constant, not a new binding + | + = note: expected type `i32` + found struct `RangeInclusive<i32>` + = note: constants only support matching by type, if you meant to match against a range of values, consider using a range pattern like `min ..= max` in the match block + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-7660.rs b/tests/ui/issues/issue-7660.rs new file mode 100644 index 000000000..ad0b8ecff --- /dev/null +++ b/tests/ui/issues/issue-7660.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(unused_variables)] +// Regression test for issue 7660 +// rvalue lifetime too short when equivalent `match` works + +// pretty-expanded FIXME #23616 + +use std::collections::HashMap; + +struct A(isize, isize); + +pub fn main() { + let mut m: HashMap<isize, A> = HashMap::new(); + m.insert(1, A(0, 0)); + + let A(ref _a, ref _b) = m[&1]; + let (a, b) = match m[&1] { A(ref _a, ref _b) => (_a, _b) }; +} diff --git a/tests/ui/issues/issue-7663.rs b/tests/ui/issues/issue-7663.rs new file mode 100644 index 000000000..b15e215db --- /dev/null +++ b/tests/ui/issues/issue-7663.rs @@ -0,0 +1,32 @@ +// run-pass + +#![allow(unused_imports, dead_code)] + +mod test1 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use test1::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +mod test2 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use test2::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +fn main() { + test1::baz::my_main(); + test2::baz::my_main(); +} diff --git a/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs new file mode 100644 index 000000000..c089c3308 --- /dev/null +++ b/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs @@ -0,0 +1,20 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +/* + +#7673 Polymorphically creating traits barely works + +*/ + +pub fn main() {} + +trait A { + fn dummy(&self) { } +} + +impl<T: 'static> A for T {} + +fn owned2<T: 'static>(a: Box<T>) { a as Box<dyn A>; } +fn owned3<T: 'static>(a: Box<T>) { Box::new(a) as Box<dyn A>; } diff --git a/tests/ui/issues/issue-77218/issue-77218-2.fixed b/tests/ui/issues/issue-77218/issue-77218-2.fixed new file mode 100644 index 000000000..0e835d49c --- /dev/null +++ b/tests/ui/issues/issue-77218/issue-77218-2.fixed @@ -0,0 +1,6 @@ +// run-rustfix +fn main() { + let value = [7u8]; + while let Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment + } +} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.rs b/tests/ui/issues/issue-77218/issue-77218-2.rs new file mode 100644 index 000000000..01dca1ae1 --- /dev/null +++ b/tests/ui/issues/issue-77218/issue-77218-2.rs @@ -0,0 +1,6 @@ +// run-rustfix +fn main() { + let value = [7u8]; + while Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment + } +} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.stderr b/tests/ui/issues/issue-77218/issue-77218-2.stderr new file mode 100644 index 000000000..58c1c18f9 --- /dev/null +++ b/tests/ui/issues/issue-77218/issue-77218-2.stderr @@ -0,0 +1,16 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-77218-2.rs:4:19 + | +LL | while Some(0) = value.get(0) { + | - ^ + | | + | cannot assign to this expression + | +help: you might have meant to use pattern destructuring + | +LL | while let Some(0) = value.get(0) { + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/issues/issue-77218/issue-77218.fixed b/tests/ui/issues/issue-77218/issue-77218.fixed new file mode 100644 index 000000000..4907b43b9 --- /dev/null +++ b/tests/ui/issues/issue-77218/issue-77218.fixed @@ -0,0 +1,5 @@ +// run-rustfix +fn main() { + let value = [7u8]; + while let Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment +} diff --git a/tests/ui/issues/issue-77218/issue-77218.rs b/tests/ui/issues/issue-77218/issue-77218.rs new file mode 100644 index 000000000..0ed154bf4 --- /dev/null +++ b/tests/ui/issues/issue-77218/issue-77218.rs @@ -0,0 +1,5 @@ +// run-rustfix +fn main() { + let value = [7u8]; + while Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment +} diff --git a/tests/ui/issues/issue-77218/issue-77218.stderr b/tests/ui/issues/issue-77218/issue-77218.stderr new file mode 100644 index 000000000..eda635646 --- /dev/null +++ b/tests/ui/issues/issue-77218/issue-77218.stderr @@ -0,0 +1,16 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-77218.rs:4:19 + | +LL | while Some(0) = value.get(0) {} + | - ^ + | | + | cannot assign to this expression + | +help: you might have meant to use pattern destructuring + | +LL | while let Some(0) = value.get(0) {} + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/issues/issue-7784.rs b/tests/ui/issues/issue-7784.rs new file mode 100644 index 000000000..b7323f09d --- /dev/null +++ b/tests/ui/issues/issue-7784.rs @@ -0,0 +1,30 @@ +// run-pass + +use std::ops::Add; + +fn foo<T: Add<Output=T> + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { + (x.clone(), x.clone() + y.clone(), x + y + z) +} +fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { + [a, b, b, a] +} + +fn main() { + assert_eq!(foo([1, 2, 3]), (1, 3, 6)); + + let [a, b, c, d] = bar("foo", "bar"); + assert_eq!(a, "foo"); + assert_eq!(b, "bar"); + assert_eq!(c, "bar"); + assert_eq!(d, "foo"); + + let [a, _, _, d] = bar("baz", "foo"); + assert_eq!(a, "baz"); + assert_eq!(d, "baz"); + + let out = bar("baz", "foo"); + let [a, xs @ .., d] = out; + assert_eq!(a, "baz"); + assert_eq!(xs, ["foo", "foo"]); + assert_eq!(d, "baz"); +} diff --git a/tests/ui/issues/issue-77919.rs b/tests/ui/issues/issue-77919.rs new file mode 100644 index 000000000..966d76d14 --- /dev/null +++ b/tests/ui/issues/issue-77919.rs @@ -0,0 +1,13 @@ +fn main() { + [1; <Multiply<Five, Five>>::VAL]; +} +trait TypeVal<T> { + const VAL: T; +} +struct Five; +struct Multiply<N, M> { + _n: PhantomData, //~ ERROR cannot find type `PhantomData` in this scope +} +impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} +//~^ ERROR cannot find type `VAL` in this scope +//~| ERROR not all trait items implemented, missing: `VAL` diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr new file mode 100644 index 000000000..d154bfe0c --- /dev/null +++ b/tests/ui/issues/issue-77919.stderr @@ -0,0 +1,35 @@ +error[E0412]: cannot find type `PhantomData` in this scope + --> $DIR/issue-77919.rs:9:9 + | +LL | _n: PhantomData, + | ^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +LL | use std::marker::PhantomData; + | + +error[E0412]: cannot find type `VAL` in this scope + --> $DIR/issue-77919.rs:11:63 + | +LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} + | ^^^ not found in this scope + | +help: you might be missing a type parameter + | +LL | impl<N, M, VAL> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} + | +++++ + +error[E0046]: not all trait items implemented, missing: `VAL` + --> $DIR/issue-77919.rs:11:1 + | +LL | const VAL: T; + | ------------ `VAL` from trait +... +LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0046, E0412. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/issues/issue-78115.rs b/tests/ui/issues/issue-78115.rs new file mode 100644 index 000000000..ac18470c6 --- /dev/null +++ b/tests/ui/issues/issue-78115.rs @@ -0,0 +1,19 @@ +// Regression test for issue #78115: "ICE: variable should be placed in scope earlier" + +// check-pass +// edition:2018 + +#[allow(dead_code)] +struct Foo { + a: () +} + +async fn _bar() { + let foo = Foo { a: () }; + match foo { + Foo { a: _a } | Foo { a: _a } if true => {} + _ => {} + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-7813.rs b/tests/ui/issues/issue-7813.rs new file mode 100644 index 000000000..ce549bde6 --- /dev/null +++ b/tests/ui/issues/issue-7813.rs @@ -0,0 +1,4 @@ +fn main() { + let v = &[]; //~ ERROR type annotations needed + let it = v.iter(); +} diff --git a/tests/ui/issues/issue-7813.stderr b/tests/ui/issues/issue-7813.stderr new file mode 100644 index 000000000..2a747f679 --- /dev/null +++ b/tests/ui/issues/issue-7813.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `&[_; 0]` + --> $DIR/issue-7813.rs:2:9 + | +LL | let v = &[]; + | ^ --- type must be known at this point + | +help: consider giving `v` an explicit type, where the placeholders `_` are specified + | +LL | let v: &[_; 0] = &[]; + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-78192.rs b/tests/ui/issues/issue-78192.rs new file mode 100644 index 000000000..b5c300159 --- /dev/null +++ b/tests/ui/issues/issue-78192.rs @@ -0,0 +1,17 @@ +// run-pass + +#![allow(unused_assignments)] + +fn main() { + let a = 1u32; + let b = 2u32; + + let mut c: *const u32 = &a; + let d: &u32 = &b; + + let x = unsafe { &*c }; + c = d; + let z = *x; + + assert_eq!(1, z); +} diff --git a/tests/ui/issues/issue-78622.rs b/tests/ui/issues/issue-78622.rs new file mode 100644 index 000000000..c00fd2660 --- /dev/null +++ b/tests/ui/issues/issue-78622.rs @@ -0,0 +1,7 @@ +#![crate_type = "lib"] + +struct S; +fn f() { + S::A::<f> {} + //~^ ERROR ambiguous associated type +} diff --git a/tests/ui/issues/issue-78622.stderr b/tests/ui/issues/issue-78622.stderr new file mode 100644 index 000000000..70daf8a2f --- /dev/null +++ b/tests/ui/issues/issue-78622.stderr @@ -0,0 +1,14 @@ +error[E0223]: ambiguous associated type + --> $DIR/issue-78622.rs:5:5 + | +LL | S::A::<f> {} + | ^^^^ + | +help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path + | +LL | <S as Example>::A::<f> {} + | ~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/issues/issue-7867.rs b/tests/ui/issues/issue-7867.rs new file mode 100644 index 000000000..3074052f1 --- /dev/null +++ b/tests/ui/issues/issue-7867.rs @@ -0,0 +1,14 @@ +enum A { B, C } + +mod foo { pub fn bar() {} } + +fn main() { + match (true, false) { + A::B => (), + //~^ ERROR mismatched types + //~| expected tuple, found enum `A` + //~| expected tuple `(bool, bool)` + //~| found enum `A` + _ => () + } +} diff --git a/tests/ui/issues/issue-7867.stderr b/tests/ui/issues/issue-7867.stderr new file mode 100644 index 000000000..0d3121d60 --- /dev/null +++ b/tests/ui/issues/issue-7867.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/issue-7867.rs:7:9 + | +LL | enum A { B, C } + | - unit variant defined here +... +LL | match (true, false) { + | ------------- this expression has type `(bool, bool)` +LL | A::B => (), + | ^^^^ expected tuple, found enum `A` + | + = note: expected tuple `(bool, bool)` + found enum `A` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-78957.rs b/tests/ui/issues/issue-78957.rs new file mode 100644 index 000000000..567c59fd5 --- /dev/null +++ b/tests/ui/issues/issue-78957.rs @@ -0,0 +1,29 @@ +#![deny(unused_attributes)] + +use std::marker::PhantomData; + +pub struct Foo<#[inline] const N: usize>; +//~^ ERROR attribute should be applied to function or closure +pub struct Bar<#[cold] const N: usize>; +//~^ ERROR attribute should be applied to a function +//~| WARN this was previously accepted +pub struct Baz<#[repr(C)] const N: usize>; +//~^ ERROR attribute should be applied to a struct, enum, or union +// +pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); +//~^ ERROR attribute should be applied to function or closure +pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); +//~^ ERROR attribute should be applied to a function +//~| WARN this was previously accepted +pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); +//~^ ERROR attribute should be applied to a struct, enum, or union +// +pub struct Foo3<#[inline] T>(PhantomData<T>); +//~^ ERROR attribute should be applied to function or closure +pub struct Bar3<#[cold] T>(PhantomData<T>); +//~^ ERROR attribute should be applied to a function +//~| WARN this was previously accepted +pub struct Baz3<#[repr(C)] T>(PhantomData<T>); +//~^ ERROR attribute should be applied to a struct, enum, or union + +fn main() {} diff --git a/tests/ui/issues/issue-78957.stderr b/tests/ui/issues/issue-78957.stderr new file mode 100644 index 000000000..6de22d6bf --- /dev/null +++ b/tests/ui/issues/issue-78957.stderr @@ -0,0 +1,69 @@ +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-78957.rs:5:16 + | +LL | pub struct Foo<#[inline] const N: usize>; + | ^^^^^^^^^ -------------- not a function or closure + +error: attribute should be applied to a function definition + --> $DIR/issue-78957.rs:7:16 + | +LL | pub struct Bar<#[cold] const N: usize>; + | ^^^^^^^ -------------- not a function definition + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! +note: the lint level is defined here + --> $DIR/issue-78957.rs:1:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-78957.rs:10:23 + | +LL | pub struct Baz<#[repr(C)] const N: usize>; + | ^ -------------- not a struct, enum, or union + +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-78957.rs:13:17 + | +LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); + | ^^^^^^^^^ -- not a function or closure + +error: attribute should be applied to a function definition + --> $DIR/issue-78957.rs:15:17 + | +LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); + | ^^^^^^^ -- not a function definition + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-78957.rs:18:24 + | +LL | pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); + | ^ -- not a struct, enum, or union + +error[E0518]: attribute should be applied to function or closure + --> $DIR/issue-78957.rs:21:17 + | +LL | pub struct Foo3<#[inline] T>(PhantomData<T>); + | ^^^^^^^^^ - not a function or closure + +error: attribute should be applied to a function definition + --> $DIR/issue-78957.rs:23:17 + | +LL | pub struct Bar3<#[cold] T>(PhantomData<T>); + | ^^^^^^^ - not a function definition + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/issue-78957.rs:26:24 + | +LL | pub struct Baz3<#[repr(C)] T>(PhantomData<T>); + | ^ - not a struct, enum, or union + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0517, E0518. +For more information about an error, try `rustc --explain E0517`. diff --git a/tests/ui/issues/issue-7899.rs b/tests/ui/issues/issue-7899.rs new file mode 100644 index 000000000..fb631f836 --- /dev/null +++ b/tests/ui/issues/issue-7899.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(unused_variables)] +// aux-build:issue-7899.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_7899 as testcrate; + +fn main() { + let f = testcrate::V2(1.0f32, 2.0f32); +} diff --git a/tests/ui/issues/issue-7911.rs b/tests/ui/issues/issue-7911.rs new file mode 100644 index 000000000..f64887136 --- /dev/null +++ b/tests/ui/issues/issue-7911.rs @@ -0,0 +1,37 @@ +// run-pass +// (Closes #7911) Test that we can use the same self expression +// with different mutability in macro in two methods + +#![allow(unused_variables)] // unused foobar_immut + foobar_mut +trait FooBar { + fn dummy(&self) { } +} +struct Bar(#[allow(unused_tuple_struct_fields)] i32); +struct Foo { bar: Bar } + +impl FooBar for Bar {} + +trait Test { + fn get_immut(&self) -> &dyn FooBar; + fn get_mut(&mut self) -> &mut dyn FooBar; +} + +macro_rules! generate_test { ($type_:path, $slf:ident, $field:expr) => ( + impl Test for $type_ { + fn get_immut(&$slf) -> &dyn FooBar { + &$field as &dyn FooBar + } + + fn get_mut(&mut $slf) -> &mut dyn FooBar { + &mut $field as &mut dyn FooBar + } + } +)} + +generate_test!(Foo, self, self.bar); + +pub fn main() { + let mut foo: Foo = Foo { bar: Bar(42) }; + { let foobar_immut = foo.get_immut(); } + { let foobar_mut = foo.get_mut(); } +} diff --git a/tests/ui/issues/issue-7950.rs b/tests/ui/issues/issue-7950.rs new file mode 100644 index 000000000..d3dcb3380 --- /dev/null +++ b/tests/ui/issues/issue-7950.rs @@ -0,0 +1,8 @@ +// tests the good error message, not "missing module Foo" or something else unexpected + +struct Foo; + +fn main() { + Foo::bar(); + //~^ ERROR no function or associated item named `bar` found for struct `Foo` +} diff --git a/tests/ui/issues/issue-7950.stderr b/tests/ui/issues/issue-7950.stderr new file mode 100644 index 000000000..b8b0eb310 --- /dev/null +++ b/tests/ui/issues/issue-7950.stderr @@ -0,0 +1,12 @@ +error[E0599]: no function or associated item named `bar` found for struct `Foo` in the current scope + --> $DIR/issue-7950.rs:6:10 + | +LL | struct Foo; + | ---------- function or associated item `bar` not found for this struct +... +LL | Foo::bar(); + | ^^^ function or associated item not found in `Foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/issues/issue-7970a.rs b/tests/ui/issues/issue-7970a.rs new file mode 100644 index 000000000..dae906410 --- /dev/null +++ b/tests/ui/issues/issue-7970a.rs @@ -0,0 +1,8 @@ +macro_rules! one_arg_macro { + ($fmt:expr) => (print!(concat!($fmt, "\n"))); +} + +fn main() { + one_arg_macro!(); + //~^ ERROR unexpected end of macro invocation +} diff --git a/tests/ui/issues/issue-7970a.stderr b/tests/ui/issues/issue-7970a.stderr new file mode 100644 index 000000000..b04a0eef3 --- /dev/null +++ b/tests/ui/issues/issue-7970a.stderr @@ -0,0 +1,17 @@ +error: unexpected end of macro invocation + --> $DIR/issue-7970a.rs:6:5 + | +LL | macro_rules! one_arg_macro { + | -------------------------- when calling this macro +... +LL | one_arg_macro!(); + | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments + | +note: while trying to match meta-variable `$fmt:expr` + --> $DIR/issue-7970a.rs:2:6 + | +LL | ($fmt:expr) => (print!(concat!($fmt, "\n"))); + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/issues/issue-8044.rs b/tests/ui/issues/issue-8044.rs new file mode 100644 index 000000000..858f98b65 --- /dev/null +++ b/tests/ui/issues/issue-8044.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-8044.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_8044 as minimal; +use minimal::{BTree, leaf}; + +pub fn main() { + BTree::<isize> { node: leaf(1) }; +} diff --git a/tests/ui/issues/issue-80607.rs b/tests/ui/issues/issue-80607.rs new file mode 100644 index 000000000..63f4df359 --- /dev/null +++ b/tests/ui/issues/issue-80607.rs @@ -0,0 +1,10 @@ +// This tests makes sure the diagnostics print the offending enum variant, not just the type. +pub enum Enum { + V1(i32), +} + +pub fn foo(x: i32) -> Enum { + Enum::V1 { x } //~ ERROR `Enum::V1` has no field named `x` +} + +fn main() {} diff --git a/tests/ui/issues/issue-80607.stderr b/tests/ui/issues/issue-80607.stderr new file mode 100644 index 000000000..38e46683b --- /dev/null +++ b/tests/ui/issues/issue-80607.stderr @@ -0,0 +1,17 @@ +error[E0559]: variant `Enum::V1` has no field named `x` + --> $DIR/issue-80607.rs:7:16 + | +LL | V1(i32), + | -- `Enum::V1` defined here +... +LL | Enum::V1 { x } + | ^ field does not exist + | +help: `Enum::V1` is a tuple variant, use the appropriate syntax + | +LL | Enum::V1(/* fields */) + | ~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0559`. diff --git a/tests/ui/issues/issue-81584.fixed b/tests/ui/issues/issue-81584.fixed new file mode 100644 index 000000000..1cad59f10 --- /dev/null +++ b/tests/ui/issues/issue-81584.fixed @@ -0,0 +1,8 @@ +// run-rustfix +fn main() { + let _ = vec![vec![0, 1], vec![2]] + .into_iter() + .map(|y| y.iter().map(|x| x + 1).collect::<Vec<_>>()) + //~^ ERROR cannot return value referencing function parameter `y` + .collect::<Vec<_>>(); +} diff --git a/tests/ui/issues/issue-81584.rs b/tests/ui/issues/issue-81584.rs new file mode 100644 index 000000000..452288db0 --- /dev/null +++ b/tests/ui/issues/issue-81584.rs @@ -0,0 +1,8 @@ +// run-rustfix +fn main() { + let _ = vec![vec![0, 1], vec![2]] + .into_iter() + .map(|y| y.iter().map(|x| x + 1)) + //~^ ERROR cannot return value referencing function parameter `y` + .collect::<Vec<_>>(); +} diff --git a/tests/ui/issues/issue-81584.stderr b/tests/ui/issues/issue-81584.stderr new file mode 100644 index 000000000..54973cfa3 --- /dev/null +++ b/tests/ui/issues/issue-81584.stderr @@ -0,0 +1,14 @@ +error[E0515]: cannot return value referencing function parameter `y` + --> $DIR/issue-81584.rs:5:22 + | +LL | .map(|y| y.iter().map(|x| x + 1)) + | --------^^^^^^^^^^^^^^^ + | | + | returns a value referencing data owned by the current function + | `y` is borrowed here + | + = help: use `.collect()` to allocate the iterator + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs new file mode 100644 index 000000000..505e7b84b --- /dev/null +++ b/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs @@ -0,0 +1,19 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +/* + +#8171 Self is not recognised as implementing kinds in default method implementations + +*/ + +fn require_send<T: Send>(_: T){} + +trait TragicallySelfIsNotSend: Send + Sized { + fn x(self) { + require_send(self); + } +} + +pub fn main(){} diff --git a/tests/ui/issues/issue-81918.rs b/tests/ui/issues/issue-81918.rs new file mode 100644 index 000000000..8938b8a6f --- /dev/null +++ b/tests/ui/issues/issue-81918.rs @@ -0,0 +1,11 @@ +// check-pass +// dont-check-compiler-stdout +// compile-flags: -Z unpretty=mir-cfg + +// This checks that unpretty=mir-cfg does not panic. See #81918. + +const TAG: &'static str = "ABCD"; + +fn main() { + if TAG == "" {} +} diff --git a/tests/ui/issues/issue-8248.rs b/tests/ui/issues/issue-8248.rs new file mode 100644 index 000000000..31a305c31 --- /dev/null +++ b/tests/ui/issues/issue-8248.rs @@ -0,0 +1,15 @@ +// run-pass +// pretty-expanded FIXME #23616 + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +fn foo(_: &mut dyn A) {} + +pub fn main() { + let mut b = B; + foo(&mut b as &mut dyn A); +} diff --git a/tests/ui/issues/issue-8249.rs b/tests/ui/issues/issue-8249.rs new file mode 100644 index 000000000..d09dff3a6 --- /dev/null +++ b/tests/ui/issues/issue-8249.rs @@ -0,0 +1,20 @@ +// run-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +struct C<'a> { + foo: &'a mut (dyn A+'a), +} + +fn foo(a: &mut dyn A) { + C{ foo: a }; +} + +pub fn main() { +} diff --git a/tests/ui/issues/issue-8259.rs b/tests/ui/issues/issue-8259.rs new file mode 100644 index 000000000..2802bea7f --- /dev/null +++ b/tests/ui/issues/issue-8259.rs @@ -0,0 +1,12 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +// aux-build:issue-8259.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_8259 as other; +static a: other::Foo<'static> = other::Foo::A; + +pub fn main() {} diff --git a/tests/ui/issues/issue-82833-slice-miscompile.rs b/tests/ui/issues/issue-82833-slice-miscompile.rs new file mode 100644 index 000000000..8cf6a3137 --- /dev/null +++ b/tests/ui/issues/issue-82833-slice-miscompile.rs @@ -0,0 +1,16 @@ +// run-pass +// compile-flags: -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2 + +// Make sure LLVM does not miscompile this. + +fn make_string(ch: char) -> String { + let mut bytes = [0u8; 4]; + ch.encode_utf8(&mut bytes).into() +} + +fn main() { + let ch = '😃'; + dbg!(ch); + let string = make_string(ch); + dbg!(string); +} diff --git a/tests/ui/issues/issue-83048.rs b/tests/ui/issues/issue-83048.rs new file mode 100644 index 000000000..8e4fb6eae --- /dev/null +++ b/tests/ui/issues/issue-83048.rs @@ -0,0 +1,5 @@ +// compile-flags: -Z unpretty=thir-tree + +pub fn main() { + break; //~ ERROR: `break` outside of a loop or labeled block [E0268] +} diff --git a/tests/ui/issues/issue-83048.stderr b/tests/ui/issues/issue-83048.stderr new file mode 100644 index 000000000..dade9e469 --- /dev/null +++ b/tests/ui/issues/issue-83048.stderr @@ -0,0 +1,9 @@ +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/issue-83048.rs:4:5 + | +LL | break; + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-83190.rs b/tests/ui/issues/issue-83190.rs new file mode 100644 index 000000000..da931c3ed --- /dev/null +++ b/tests/ui/issues/issue-83190.rs @@ -0,0 +1,49 @@ +// check-pass + +// Regression test for issue #83190, triggering an ICE in borrowck. + +pub trait Any {} +impl<T> Any for T {} + +pub trait StreamOnce { + type Range; +} + +pub trait Parser<Input>: Sized { + type Output; + type PartialState; + fn map(self) -> Map<Self> { + todo!() + } +} + +pub struct Map<P>(P); +impl<I, P: Parser<I, Output = ()>> Parser<I> for Map<P> { + type Output = (); + type PartialState = P::PartialState; +} + +struct TakeWhile1<Input>(Input); +impl<I: StreamOnce> Parser<I> for TakeWhile1<I> { + type Output = I::Range; + type PartialState = (); +} +impl<I> TakeWhile1<I> { + fn new() -> Self { + todo!() + } +} + +impl<I, A: Parser<I>> Parser<I> for (A,) { + type Output = (); + type PartialState = Map<A::Output>; +} + +pub fn metric_stream_parser<'a, I>() -> impl Parser<I, Output = (), PartialState = impl Any + 'a> +where + I: StreamOnce<Range = &'a [()]>, +{ + (TakeWhile1::new(),).map() +} + +fn main() {} diff --git a/tests/ui/issues/issue-8391.rs b/tests/ui/issues/issue-8391.rs new file mode 100644 index 000000000..1a9036965 --- /dev/null +++ b/tests/ui/issues/issue-8391.rs @@ -0,0 +1,9 @@ +// run-pass + +fn main() { + let x = match Some(1) { + ref _y @ Some(_) => 1, + None => 2, + }; + assert_eq!(x, 1); +} diff --git a/tests/ui/issues/issue-83924.fixed b/tests/ui/issues/issue-83924.fixed new file mode 100644 index 000000000..aa40da12b --- /dev/null +++ b/tests/ui/issues/issue-83924.fixed @@ -0,0 +1,20 @@ +// run-rustfix + +fn main() { + let mut values = vec![10, 11, 12]; + let v = &mut values; + + let mut max = 0; + + for n in &mut *v { + max = std::cmp::max(max, *n); + } + + println!("max is {}", max); + println!("Converting to percentages of maximum value..."); + for n in v { + //~^ ERROR: use of moved value: `v` [E0382] + *n = 100 * (*n) / max; + } + println!("values: {:#?}", values); +} diff --git a/tests/ui/issues/issue-83924.rs b/tests/ui/issues/issue-83924.rs new file mode 100644 index 000000000..22b80fe2f --- /dev/null +++ b/tests/ui/issues/issue-83924.rs @@ -0,0 +1,20 @@ +// run-rustfix + +fn main() { + let mut values = vec![10, 11, 12]; + let v = &mut values; + + let mut max = 0; + + for n in v { + max = std::cmp::max(max, *n); + } + + println!("max is {}", max); + println!("Converting to percentages of maximum value..."); + for n in v { + //~^ ERROR: use of moved value: `v` [E0382] + *n = 100 * (*n) / max; + } + println!("values: {:#?}", values); +} diff --git a/tests/ui/issues/issue-83924.stderr b/tests/ui/issues/issue-83924.stderr new file mode 100644 index 000000000..572414df2 --- /dev/null +++ b/tests/ui/issues/issue-83924.stderr @@ -0,0 +1,22 @@ +error[E0382]: use of moved value: `v` + --> $DIR/issue-83924.rs:15:14 + | +LL | let v = &mut values; + | - move occurs because `v` has type `&mut Vec<i32>`, which does not implement the `Copy` trait +... +LL | for n in v { + | - `v` moved due to this implicit call to `.into_iter()` +... +LL | for n in v { + | ^ value used here after move + | +note: `into_iter` takes ownership of the receiver `self`, which moves `v` + --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL +help: consider creating a fresh reborrow of `v` here + | +LL | for n in &mut *v { + | ++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-8398.rs b/tests/ui/issues/issue-8398.rs new file mode 100644 index 000000000..0ef39b6a6 --- /dev/null +++ b/tests/ui/issues/issue-8398.rs @@ -0,0 +1,13 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +pub trait Writer { + fn write(&mut self, b: &[u8]) -> Result<(), ()>; +} + +fn foo(a: &mut dyn Writer) { + a.write(&[]).unwrap(); +} + +pub fn main(){} diff --git a/tests/ui/issues/issue-8401.rs b/tests/ui/issues/issue-8401.rs new file mode 100644 index 000000000..1257bab6c --- /dev/null +++ b/tests/ui/issues/issue-8401.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-8401.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_8401; + +pub fn main() {} diff --git a/tests/ui/issues/issue-8498.rs b/tests/ui/issues/issue-8498.rs new file mode 100644 index 000000000..e6241b761 --- /dev/null +++ b/tests/ui/issues/issue-8498.rs @@ -0,0 +1,27 @@ +// run-pass + +pub fn main() { + match &[(Box::new(5),Box::new(7))] { + ps => { + let (ref y, _) = ps[0]; + assert_eq!(**y, 5); + } + } + + match Some(&[(Box::new(5),)]) { + Some(ps) => { + let (ref y,) = ps[0]; + assert_eq!(**y, 5); + } + None => () + } + + match Some(&[(Box::new(5),Box::new(7))]) { + Some(ps) => { + let (ref y, ref z) = ps[0]; + assert_eq!(**y, 5); + assert_eq!(**z, 7); + } + None => () + } +} diff --git a/tests/ui/issues/issue-8506.rs b/tests/ui/issues/issue-8506.rs new file mode 100644 index 000000000..cc32b8923 --- /dev/null +++ b/tests/ui/issues/issue-8506.rs @@ -0,0 +1,14 @@ +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_upper_case_globals)] + +#![allow(dead_code)] + +enum Either { + One, + Other(String,String) +} + +static one : Either = Either::One; + +pub fn main () { } diff --git a/tests/ui/issues/issue-8521.rs b/tests/ui/issues/issue-8521.rs new file mode 100644 index 000000000..15fbd4465 --- /dev/null +++ b/tests/ui/issues/issue-8521.rs @@ -0,0 +1,25 @@ +// check-pass +trait Foo1 {} + +trait A {} + +macro_rules! foo1(($t:path) => { + impl<T: $t> Foo1 for T {} +}); + +foo1!(A); + +trait Foo2 {} + +trait B<T> {} + +#[allow(unused)] +struct C {} + +macro_rules! foo2(($t:path) => { + impl<T: $t> Foo2 for T {} +}); + +foo2!(B<C>); + +fn main() {} diff --git a/tests/ui/issues/issue-85461.rs b/tests/ui/issues/issue-85461.rs new file mode 100644 index 000000000..965510887 --- /dev/null +++ b/tests/ui/issues/issue-85461.rs @@ -0,0 +1,27 @@ +// compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 +// build-pass +// needs-profiler-support + +// Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries +// with dead code and #[inline(always)]. + +#![allow(dead_code)] + +mod foo { + #[inline(always)] + pub fn called() { } + + fn uncalled() { } +} + +pub mod bar { + pub fn call_me() { + super::foo::called(); + } +} + +pub mod baz { + pub fn call_me() { + super::foo::called(); + } +} diff --git a/tests/ui/issues/issue-8578.rs b/tests/ui/issues/issue-8578.rs new file mode 100644 index 000000000..2346ef5a9 --- /dev/null +++ b/tests/ui/issues/issue-8578.rs @@ -0,0 +1,20 @@ +// check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] +// pretty-expanded FIXME #23616 + +pub struct UninterpretedOption_NamePart { + name_part: Option<String>, +} + +impl<'a> UninterpretedOption_NamePart { + pub fn default_instance() -> &'static UninterpretedOption_NamePart { + static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart { + name_part: None, + }; + &instance + } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-86756.rs b/tests/ui/issues/issue-86756.rs new file mode 100644 index 000000000..7f864eb28 --- /dev/null +++ b/tests/ui/issues/issue-86756.rs @@ -0,0 +1,12 @@ +trait Foo<T, T = T> {} +//~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters + +fn eq<A, B>() { + eq::<dyn, Foo> + //~^ ERROR cannot find type `dyn` in this scope + //~| ERROR missing generics for trait `Foo` + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition +} + +fn main() {} diff --git a/tests/ui/issues/issue-86756.stderr b/tests/ui/issues/issue-86756.stderr new file mode 100644 index 000000000..bfa7459ab --- /dev/null +++ b/tests/ui/issues/issue-86756.stderr @@ -0,0 +1,48 @@ +error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters + --> $DIR/issue-86756.rs:1:14 + | +LL | trait Foo<T, T = T> {} + | - ^ already used + | | + | first use of `T` + +error[E0412]: cannot find type `dyn` in this scope + --> $DIR/issue-86756.rs:5:10 + | +LL | eq::<dyn, Foo> + | ^^^ not found in this scope + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-86756.rs:5:15 + | +LL | eq::<dyn, Foo> + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `#[warn(bare_trait_objects)]` on by default +help: use `dyn` + | +LL | eq::<dyn, dyn Foo> + | +++ + +error[E0107]: missing generics for trait `Foo` + --> $DIR/issue-86756.rs:5:15 + | +LL | eq::<dyn, Foo> + | ^^^ expected at least 1 generic argument + | +note: trait defined here, with at least 1 generic parameter: `T` + --> $DIR/issue-86756.rs:1:7 + | +LL | trait Foo<T, T = T> {} + | ^^^ - +help: add missing generic argument + | +LL | eq::<dyn, Foo<T>> + | +++ + +error: aborting due to 3 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0107, E0403, E0412. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-868.rs b/tests/ui/issues/issue-868.rs new file mode 100644 index 000000000..ce0a3c7ca --- /dev/null +++ b/tests/ui/issues/issue-868.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(unused_parens)] +// pretty-expanded FIXME #23616 + +fn f<T, F>(g: F) -> T where F: FnOnce() -> T { g() } + +pub fn main() { + let _x = f( | | { 10 }); + // used to be: cannot determine a type for this expression + f(| | { }); + // ditto + f( | | { ()}); + // always worked + let _: () = f(| | { }); + // empty block with no type info should compile too + let _ = f(||{}); + let _ = (||{}); +} diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs new file mode 100644 index 000000000..a80a64a2f --- /dev/null +++ b/tests/ui/issues/issue-87199.rs @@ -0,0 +1,20 @@ +// Regression test for issue #87199, where attempting to relax a bound +// other than the only supported `?Sized` would still cause the compiler +// to assume that the `Sized` bound was relaxed. + +// check-fail + +// Check that these function definitions only emit warnings, not errors +fn arg<T: ?Send>(_: T) {} +//~^ warning: default bound relaxed for a type parameter, but this does nothing +fn ref_arg<T: ?Send>(_: &T) {} +//~^ warning: default bound relaxed for a type parameter, but this does nothing +fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } +//~^ warning: default bound relaxed for a type parameter, but this does nothing + +// Check that there's no `?Sized` relaxation! +fn main() { + ref_arg::<i32>(&5); + ref_arg::<[i32]>(&[5]); + //~^ the size for values of type `[i32]` cannot be known +} diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr new file mode 100644 index 000000000..0ec5e73f3 --- /dev/null +++ b/tests/ui/issues/issue-87199.stderr @@ -0,0 +1,40 @@ +warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported + --> $DIR/issue-87199.rs:8:8 + | +LL | fn arg<T: ?Send>(_: T) {} + | ^ + +warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported + --> $DIR/issue-87199.rs:10:12 + | +LL | fn ref_arg<T: ?Send>(_: &T) {} + | ^ + +warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported + --> $DIR/issue-87199.rs:12:13 + | +LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: the size for values of type `[i32]` cannot be known at compilation time + --> $DIR/issue-87199.rs:18:22 + | +LL | ref_arg::<[i32]>(&[5]); + | ---------------- ^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | + = help: the trait `Sized` is not implemented for `[i32]` +note: required by a bound in `ref_arg` + --> $DIR/issue-87199.rs:10:12 + | +LL | fn ref_arg<T: ?Send>(_: &T) {} + | ^ required by this bound in `ref_arg` +help: consider relaxing the implicit `Sized` restriction + | +LL | fn ref_arg<T: ?Send + ?Sized>(_: &T) {} + | ++++++++ + +error: aborting due to previous error; 3 warnings emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-8727.polonius.stderr b/tests/ui/issues/issue-8727.polonius.stderr new file mode 100644 index 000000000..283c01b6b --- /dev/null +++ b/tests/ui/issues/issue-8727.polonius.stderr @@ -0,0 +1,26 @@ +warning: function cannot return without recursing + --> $DIR/issue-8727.rs:7:1 + | +LL | fn generic<T>() { + | ^^^^^^^^^^^^^^^ cannot return without recursing +LL | generic::<Option<T>>(); + | ---------------------- recursive call site + | + = note: `#[warn(unconditional_recursion)]` on by default + = help: a `loop` may express intention better if this is on purpose + +error: reached the recursion limit while instantiating `generic::<Option<Option<Option<O...>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-8727.rs:8:5 + | +LL | generic::<Option<T>>(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `generic` defined here + --> $DIR/issue-8727.rs:7:1 + | +LL | fn generic<T>() { + | ^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-8727.polonius/issue-8727.long-type.txt' + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/issues/issue-8727.rs b/tests/ui/issues/issue-8727.rs new file mode 100644 index 000000000..a9b812661 --- /dev/null +++ b/tests/ui/issues/issue-8727.rs @@ -0,0 +1,16 @@ +// Verify the compiler fails with an error on infinite function +// recursions. + +// build-fail +// normalize-stderr-test: ".nll/" -> "/" + +fn generic<T>() { //~ WARN function cannot return without recursing + generic::<Option<T>>(); +} +//~^^ ERROR reached the recursion limit while instantiating `generic::<Option< + + +fn main () { + // Use generic<T> at least once to trigger instantiation. + generic::<i32>(); +} diff --git a/tests/ui/issues/issue-8727.stderr b/tests/ui/issues/issue-8727.stderr new file mode 100644 index 000000000..22332b357 --- /dev/null +++ b/tests/ui/issues/issue-8727.stderr @@ -0,0 +1,26 @@ +warning: function cannot return without recursing + --> $DIR/issue-8727.rs:7:1 + | +LL | fn generic<T>() { + | ^^^^^^^^^^^^^^^ cannot return without recursing +LL | generic::<Option<T>>(); + | ---------------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + = note: `#[warn(unconditional_recursion)]` on by default + +error: reached the recursion limit while instantiating `generic::<Option<Option<Option<Option<Option<...>>>>>>` + --> $DIR/issue-8727.rs:8:5 + | +LL | generic::<Option<T>>(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `generic` defined here + --> $DIR/issue-8727.rs:7:1 + | +LL | fn generic<T>() { + | ^^^^^^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-8727/issue-8727.long-type.txt' + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/issues/issue-87490.rs b/tests/ui/issues/issue-87490.rs new file mode 100644 index 000000000..998f61a6b --- /dev/null +++ b/tests/ui/issues/issue-87490.rs @@ -0,0 +1,10 @@ +fn main() {} +trait StreamOnce { + type Position; +} +impl StreamOnce for &str { + type Position = usize; +} +fn follow(_: &str) -> <&str as StreamOnce>::Position { + String::new //~ ERROR mismatched types +} diff --git a/tests/ui/issues/issue-87490.stderr b/tests/ui/issues/issue-87490.stderr new file mode 100644 index 000000000..f359dd638 --- /dev/null +++ b/tests/ui/issues/issue-87490.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-87490.rs:9:5 + | +LL | fn follow(_: &str) -> <&str as StreamOnce>::Position { + | ------------------------------ expected `usize` because of return type +LL | String::new + | ^^^^^^^^^^^ expected `usize`, found fn item + | + = note: expected type `usize` + found fn item `fn() -> String {String::new}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-8761.rs b/tests/ui/issues/issue-8761.rs new file mode 100644 index 000000000..1453c3d75 --- /dev/null +++ b/tests/ui/issues/issue-8761.rs @@ -0,0 +1,10 @@ +enum Foo { + A = 1i64, + //~^ ERROR mismatched types + //~| expected `isize`, found `i64` + B = 2u8 + //~^ ERROR mismatched types + //~| expected `isize`, found `u8` +} + +fn main() {} diff --git a/tests/ui/issues/issue-8761.stderr b/tests/ui/issues/issue-8761.stderr new file mode 100644 index 000000000..c70093baf --- /dev/null +++ b/tests/ui/issues/issue-8761.stderr @@ -0,0 +1,25 @@ +error[E0308]: mismatched types + --> $DIR/issue-8761.rs:2:9 + | +LL | A = 1i64, + | ^^^^ expected `isize`, found `i64` + | +help: change the type of the numeric literal from `i64` to `isize` + | +LL | A = 1isize, + | ~~~~~ + +error[E0308]: mismatched types + --> $DIR/issue-8761.rs:5:9 + | +LL | B = 2u8 + | ^^^ expected `isize`, found `u8` + | +help: change the type of the numeric literal from `u8` to `isize` + | +LL | B = 2isize + | ~~~~~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-8767.rs b/tests/ui/issues/issue-8767.rs new file mode 100644 index 000000000..972101a0b --- /dev/null +++ b/tests/ui/issues/issue-8767.rs @@ -0,0 +1,5 @@ +impl B { //~ ERROR cannot find type `B` in this scope +} + +fn main() { +} diff --git a/tests/ui/issues/issue-8767.stderr b/tests/ui/issues/issue-8767.stderr new file mode 100644 index 000000000..91d99f393 --- /dev/null +++ b/tests/ui/issues/issue-8767.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `B` in this scope + --> $DIR/issue-8767.rs:1:6 + | +LL | impl B { + | ^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-87707.rs b/tests/ui/issues/issue-87707.rs new file mode 100644 index 000000000..c14e52dfe --- /dev/null +++ b/tests/ui/issues/issue-87707.rs @@ -0,0 +1,17 @@ +// test for #87707 +// edition:2018 +// run-fail +// exec-env:RUST_BACKTRACE=0 +// check-run-results +// needs-unwind uses catch_unwind + +use std::sync::Once; +use std::panic; + +fn main() { + let o = Once::new(); + let _ = panic::catch_unwind(|| { + o.call_once(|| panic!("Here Once instance is poisoned.")); + }); + o.call_once(|| {}); +} diff --git a/tests/ui/issues/issue-87707.run.stderr b/tests/ui/issues/issue-87707.run.stderr new file mode 100644 index 000000000..527c78ba8 --- /dev/null +++ b/tests/ui/issues/issue-87707.run.stderr @@ -0,0 +1,3 @@ +thread 'main' panicked at 'Here Once instance is poisoned.', $DIR/issue-87707.rs:14:24 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +thread 'main' panicked at 'Once instance has previously been poisoned', $DIR/issue-87707.rs:16:7 diff --git a/tests/ui/issues/issue-8783.rs b/tests/ui/issues/issue-8783.rs new file mode 100644 index 000000000..4eb49c821 --- /dev/null +++ b/tests/ui/issues/issue-8783.rs @@ -0,0 +1,24 @@ +// run-pass +#![allow(unused_variables)] +// pretty-expanded FIXME #23616 + +use std::default::Default; + +struct X { pub x: usize } +impl Default for X { + fn default() -> X { + X { x: 42 } + } +} + +struct Y<T> { pub y: T } +impl<T: Default> Default for Y<T> { + fn default() -> Y<T> { + Y { y: Default::default() } + } +} + +fn main() { + let X { x: _ } = Default::default(); + let Y { y: X { x } } = Default::default(); +} diff --git a/tests/ui/issues/issue-88150.rs b/tests/ui/issues/issue-88150.rs new file mode 100644 index 000000000..555a38637 --- /dev/null +++ b/tests/ui/issues/issue-88150.rs @@ -0,0 +1,21 @@ +// run-pass +// compile-flags:-C debuginfo=2 +// edition:2018 + +use core::marker::PhantomData; + +pub struct Foo<T: ?Sized, A>( + PhantomData<(A, T)>, +); + +enum Never {} + +impl<T: ?Sized> Foo<T, Never> { + fn new_foo() -> Foo<T, Never> { + Foo(PhantomData) + } +} + +fn main() { + let _ = Foo::<[()], Never>::new_foo(); +} diff --git a/tests/ui/issues/issue-8860.rs b/tests/ui/issues/issue-8860.rs new file mode 100644 index 000000000..b89a80c13 --- /dev/null +++ b/tests/ui/issues/issue-8860.rs @@ -0,0 +1,49 @@ +// run-pass +#![allow(dead_code)] + +static mut DROP: isize = 0; +static mut DROP_S: isize = 0; +static mut DROP_T: isize = 0; + +struct S; +impl Drop for S { + fn drop(&mut self) { + unsafe { + DROP_S += 1; + DROP += 1; + } + } +} +fn f(ref _s: S) {} + +struct T { i: isize } +impl Drop for T { + fn drop(&mut self) { + unsafe { + DROP_T += 1; + DROP += 1; + } + } +} +fn g(ref _t: T) {} + +fn do_test() { + let s = S; + f(s); + unsafe { + assert_eq!(1, DROP); + assert_eq!(1, DROP_S); + } + let t = T { i: 1 }; + g(t); + unsafe { assert_eq!(1, DROP_T); } +} + +fn main() { + do_test(); + unsafe { + assert_eq!(2, DROP); + assert_eq!(1, DROP_S); + assert_eq!(1, DROP_T); + } +} diff --git a/tests/ui/issues/issue-8898.rs b/tests/ui/issues/issue-8898.rs new file mode 100644 index 000000000..31d5ff86e --- /dev/null +++ b/tests/ui/issues/issue-8898.rs @@ -0,0 +1,18 @@ +// run-pass + +fn assert_repr_eq<T: std::fmt::Debug>(obj : T, expected : String) { + assert_eq!(expected, format!("{:?}", obj)); +} + +pub fn main() { + let abc = [1, 2, 3]; + let tf = [true, false]; + let x = [(), ()]; + let slice = &x[..1]; + + assert_repr_eq(&abc[..], "[1, 2, 3]".to_string()); + assert_repr_eq(&tf[..], "[true, false]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); + assert_repr_eq(slice, "[()]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); +} diff --git a/tests/ui/issues/issue-9047.rs b/tests/ui/issues/issue-9047.rs new file mode 100644 index 000000000..fa8d75aec --- /dev/null +++ b/tests/ui/issues/issue-9047.rs @@ -0,0 +1,14 @@ +// run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] +fn decode() -> String { + 'outer: loop { + let mut ch_start: usize; + break 'outer; + } + "".to_string() +} + +pub fn main() { + println!("{}", decode()); +} diff --git a/tests/ui/issues/issue-9110.rs b/tests/ui/issues/issue-9110.rs new file mode 100644 index 000000000..cbf3c92d0 --- /dev/null +++ b/tests/ui/issues/issue-9110.rs @@ -0,0 +1,17 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 +#![allow(non_snake_case)] + +macro_rules! silly_macro { + () => ( + pub mod Qux { + pub struct Foo { x : u8 } + pub fn bar(_foo : Foo) {} + } + ); +} + +silly_macro!(); + +pub fn main() {} diff --git a/tests/ui/issues/issue-9123.rs b/tests/ui/issues/issue-9123.rs new file mode 100644 index 000000000..8c21d06c4 --- /dev/null +++ b/tests/ui/issues/issue-9123.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:issue-9123.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9123; + +pub fn main() {} diff --git a/tests/ui/issues/issue-9129.rs b/tests/ui/issues/issue-9129.rs new file mode 100644 index 000000000..04110b3ae --- /dev/null +++ b/tests/ui/issues/issue-9129.rs @@ -0,0 +1,32 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +// ignore-pretty unreported + +pub trait bomb { fn boom(&self, _: Ident); } +pub struct S; +impl bomb for S { fn boom(&self, _: Ident) { } } + +pub struct Ident { name: usize } + +macro_rules! int3 { () => ( { } ) } + +fn Ident_new() -> Ident { + int3!(); + Ident {name: 0x6789ABCD } +} + +pub fn light_fuse(fld: Box<dyn bomb>) { + int3!(); + let f = || { + int3!(); + fld.boom(Ident_new()); // *** 1 + }; + f(); +} + +pub fn main() { + let b = Box::new(S) as Box<dyn bomb>; + light_fuse(b); +} diff --git a/tests/ui/issues/issue-91489.rs b/tests/ui/issues/issue-91489.rs new file mode 100644 index 000000000..f028a4a3c --- /dev/null +++ b/tests/ui/issues/issue-91489.rs @@ -0,0 +1,40 @@ +// check-pass + +// regression test for #91489 + +use std::borrow::Borrow; +use std::borrow::Cow; + +pub struct VariantType {} +pub struct VariantTy {} + +impl Borrow<VariantTy> for VariantType { + fn borrow(&self) -> &VariantTy { + unimplemented!() + } +} + +impl ToOwned for VariantTy { + type Owned = VariantType; + fn to_owned(&self) -> VariantType { + unimplemented!() + } +} + +impl VariantTy { + pub fn as_str(&self) -> () {} +} + +// the presence of this was causing all attempts to call `as_str` on +// `Cow<'_, VariantTy>, including in itself, to not find the method +static _TYP: () = { + let _ = || { + // should be found + Cow::Borrowed(&VariantTy {}).as_str(); + }; +}; + +fn main() { + // should be found + Cow::Borrowed(&VariantTy {}).as_str() +} diff --git a/tests/ui/issues/issue-9155.rs b/tests/ui/issues/issue-9155.rs new file mode 100644 index 000000000..4b5c451e8 --- /dev/null +++ b/tests/ui/issues/issue-9155.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:issue-9155.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9155; + +struct Baz; + +pub fn main() { + issue_9155::Foo::new(Baz); +} diff --git a/tests/ui/issues/issue-9188.rs b/tests/ui/issues/issue-9188.rs new file mode 100644 index 000000000..34e61fdf6 --- /dev/null +++ b/tests/ui/issues/issue-9188.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-9188.rs + + +extern crate issue_9188; + +pub fn main() { + let a = issue_9188::bar(); + let b = issue_9188::foo::<isize>(); + assert_eq!(*a, *b); +} diff --git a/tests/ui/issues/issue-9243.rs b/tests/ui/issues/issue-9243.rs new file mode 100644 index 000000000..59fdb4662 --- /dev/null +++ b/tests/ui/issues/issue-9243.rs @@ -0,0 +1,16 @@ +// build-pass +#![allow(dead_code)] +// Regression test for issue 9243 +#![allow(non_upper_case_globals)] + +pub struct Test { + mem: isize, +} + +pub static g_test: Test = Test {mem: 0}; + +impl Drop for Test { + fn drop(&mut self) {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-9249.rs b/tests/ui/issues/issue-9249.rs new file mode 100644 index 000000000..caaba668a --- /dev/null +++ b/tests/ui/issues/issue-9249.rs @@ -0,0 +1,6 @@ +// check-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +static DATA:&'static [&'static str] = &["my string"]; +fn main() { } diff --git a/tests/ui/issues/issue-9259.rs b/tests/ui/issues/issue-9259.rs new file mode 100644 index 000000000..d838edbdd --- /dev/null +++ b/tests/ui/issues/issue-9259.rs @@ -0,0 +1,16 @@ +// run-pass +#![allow(dead_code)] + +struct A<'a> { + a: &'a [String], + b: Option<&'a [String]>, +} + +pub fn main() { + let b: &[String] = &["foo".to_string()]; + let a = A { + a: &["test".to_string()], + b: Some(b), + }; + assert_eq!(a.b.as_ref().unwrap()[0], "foo"); +} diff --git a/tests/ui/issues/issue-9382.rs b/tests/ui/issues/issue-9382.rs new file mode 100644 index 000000000..65718343f --- /dev/null +++ b/tests/ui/issues/issue-9382.rs @@ -0,0 +1,40 @@ +// pretty-expanded FIXME #23616 + + +// run-pass +#![allow(dead_code)] + +// Tests for a previous bug that occurred due to an interaction +// between struct field initialization and the auto-coercion +// from a vector to a slice. The drop glue was being invoked on +// the temporary slice with a wrong type, triggering an LLVM assert. + + +struct Thing1<'a> { + baz: &'a [Box<isize>], + bar: Box<u64>, +} + +struct Thing2<'a> { + baz: &'a [Box<isize>], + bar: u64, +} + +pub fn main() { + let _t1_fixed = Thing1 { + baz: &[], + bar: Box::new(32), + }; + Thing1 { + baz: &Vec::new(), + bar: Box::new(32), + }; + let _t2_fixed = Thing2 { + baz: &[], + bar: 32, + }; + Thing2 { + baz: &Vec::new(), + bar: 32, + }; +} diff --git a/tests/ui/issues/issue-9446.rs b/tests/ui/issues/issue-9446.rs new file mode 100644 index 000000000..e200840d2 --- /dev/null +++ b/tests/ui/issues/issue-9446.rs @@ -0,0 +1,30 @@ +// run-pass +struct Wrapper(String); + +impl Wrapper { + pub fn new(wrapped: String) -> Wrapper { + Wrapper(wrapped) + } + + pub fn say_hi(&self) { + let Wrapper(ref s) = *self; + println!("hello {}", *s); + } +} + +impl Drop for Wrapper { + fn drop(&mut self) {} +} + +pub fn main() { + { + // This runs without complaint. + let x = Wrapper::new("Bob".to_string()); + x.say_hi(); + } + { + // This fails to compile, circa 0.8-89-gc635fba. + // error: internal compiler error: drop_ty_immediate: non-box ty + Wrapper::new("Bob".to_string()).say_hi(); + } +} diff --git a/tests/ui/issues/issue-948.rs b/tests/ui/issues/issue-948.rs new file mode 100644 index 000000000..b9bbeb395 --- /dev/null +++ b/tests/ui/issues/issue-948.rs @@ -0,0 +1,15 @@ +// run-fail +// error-pattern:beep boop +// ignore-emscripten no processes + +#![allow(unused_variables)] + +struct Point { + x: isize, + y: isize, +} + +fn main() { + let origin = Point { x: 0, y: 0 }; + let f: Point = Point { x: (panic!("beep boop")), ..origin }; +} diff --git a/tests/ui/issues/issue-9575.rs b/tests/ui/issues/issue-9575.rs new file mode 100644 index 000000000..06b252990 --- /dev/null +++ b/tests/ui/issues/issue-9575.rs @@ -0,0 +1,7 @@ +#![feature(start)] + +#[start] +fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { + //~^ `#[start]` function has wrong type + 0 +} diff --git a/tests/ui/issues/issue-9575.stderr b/tests/ui/issues/issue-9575.stderr new file mode 100644 index 000000000..5b8ce84a0 --- /dev/null +++ b/tests/ui/issues/issue-9575.stderr @@ -0,0 +1,12 @@ +error[E0308]: `#[start]` function has wrong type + --> $DIR/issue-9575.rs:4:1 + | +LL | fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters + | + = note: expected fn pointer `fn(isize, *const *const u8) -> _` + found fn pointer `fn(isize, *const *const u8, *const u8) -> _` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-9719.rs b/tests/ui/issues/issue-9719.rs new file mode 100644 index 000000000..e8c3c9c19 --- /dev/null +++ b/tests/ui/issues/issue-9719.rs @@ -0,0 +1,41 @@ +// build-pass +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +mod a { + pub enum Enum<T> { + A(T), + } + + pub trait X { + fn dummy(&self) { } + } + impl X for isize {} + + pub struct Z<'a>(Enum<&'a (dyn X + 'a)>); + fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &dyn X)); let _ = z; } +} + +mod b { + trait X { + fn dummy(&self) { } + } + impl X for isize {} + struct Y<'a>{ + x:Option<&'a (dyn X + 'a)>, + } + + fn bar() { + let x: isize = 42; + let _y = Y { x: Some(&x as &dyn X) }; + } +} + +mod c { + pub trait X { fn f(&self); } + impl X for isize { fn f(&self) {} } + pub struct Z<'a>(Option<&'a (dyn X + 'a)>); + fn main() { let x: isize = 42; let z = Z(Some(&x as &dyn X)); let _ = z; } +} + +pub fn main() {} diff --git a/tests/ui/issues/issue-9725.rs b/tests/ui/issues/issue-9725.rs new file mode 100644 index 000000000..360effbd1 --- /dev/null +++ b/tests/ui/issues/issue-9725.rs @@ -0,0 +1,7 @@ +struct A { foo: isize } + +fn main() { + let A { foo, foo } = A { foo: 3 }; + //~^ ERROR: identifier `foo` is bound more than once in the same pattern + //~^^ ERROR: field `foo` bound multiple times +} diff --git a/tests/ui/issues/issue-9725.stderr b/tests/ui/issues/issue-9725.stderr new file mode 100644 index 000000000..687e0cc0f --- /dev/null +++ b/tests/ui/issues/issue-9725.stderr @@ -0,0 +1,18 @@ +error[E0416]: identifier `foo` is bound more than once in the same pattern + --> $DIR/issue-9725.rs:4:18 + | +LL | let A { foo, foo } = A { foo: 3 }; + | ^^^ used in a pattern more than once + +error[E0025]: field `foo` bound multiple times in the pattern + --> $DIR/issue-9725.rs:4:18 + | +LL | let A { foo, foo } = A { foo: 3 }; + | --- ^^^ multiple uses of `foo` in pattern + | | + | first use of `foo` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0025, E0416. +For more information about an error, try `rustc --explain E0025`. diff --git a/tests/ui/issues/issue-9737.rs b/tests/ui/issues/issue-9737.rs new file mode 100644 index 000000000..7d3e05678 --- /dev/null +++ b/tests/ui/issues/issue-9737.rs @@ -0,0 +1,10 @@ +// run-pass +#![allow(unused_variables)] +macro_rules! f { + (v: $x:expr) => ( println!("{}", $x) ) +} + +fn main () { + let v = 5; + f!(v: 3); +} diff --git a/tests/ui/issues/issue-979.rs b/tests/ui/issues/issue-979.rs new file mode 100644 index 000000000..57a99b325 --- /dev/null +++ b/tests/ui/issues/issue-979.rs @@ -0,0 +1,29 @@ +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +struct r<'a> { + b: &'a Cell<isize>, +} + +impl<'a> Drop for r<'a> { + fn drop(&mut self) { + self.b.set(self.b.get() + 1); + } +} + +fn r(b: &Cell<isize>) -> r { + r { + b: b + } +} + +pub fn main() { + let b = &Cell::new(0); + { + let _p = Some(r(b)); + } + + assert_eq!(b.get(), 1); +} diff --git a/tests/ui/issues/issue-9814.rs b/tests/ui/issues/issue-9814.rs new file mode 100644 index 000000000..a87478e22 --- /dev/null +++ b/tests/ui/issues/issue-9814.rs @@ -0,0 +1,8 @@ +// Verify that single-variant enums can't be de-referenced +// Regression test for issue #9814 + +enum Foo { Bar(isize) } + +fn main() { + let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced +} diff --git a/tests/ui/issues/issue-9814.stderr b/tests/ui/issues/issue-9814.stderr new file mode 100644 index 000000000..bd9e7df49 --- /dev/null +++ b/tests/ui/issues/issue-9814.stderr @@ -0,0 +1,9 @@ +error[E0614]: type `Foo` cannot be dereferenced + --> $DIR/issue-9814.rs:7:13 + | +LL | let _ = *Foo::Bar(2); + | ^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0614`. diff --git a/tests/ui/issues/issue-98299.rs b/tests/ui/issues/issue-98299.rs new file mode 100644 index 000000000..63c058f91 --- /dev/null +++ b/tests/ui/issues/issue-98299.rs @@ -0,0 +1,18 @@ +use std::convert::TryFrom; + +pub fn test_usage(p: ()) { + SmallCString::try_from(p).map(|cstr| cstr); + //~^ ERROR: type annotations needed +} + +pub struct SmallCString<const N: usize> {} + +impl<const N: usize> TryFrom<()> for SmallCString<N> { + type Error = (); + + fn try_from(path: ()) -> Result<Self, Self::Error> { + unimplemented!(); + } +} + +fn main() {} diff --git a/tests/ui/issues/issue-98299.stderr b/tests/ui/issues/issue-98299.stderr new file mode 100644 index 000000000..fd905392a --- /dev/null +++ b/tests/ui/issues/issue-98299.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `SmallCString<N>` + --> $DIR/issue-98299.rs:4:36 + | +LL | SmallCString::try_from(p).map(|cstr| cstr); + | ^^^^ + | +help: consider giving this closure parameter an explicit type, where the the value of const parameter `N` is specified + | +LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr); + | +++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-9837.rs b/tests/ui/issues/issue-9837.rs new file mode 100644 index 000000000..5d2c822a5 --- /dev/null +++ b/tests/ui/issues/issue-9837.rs @@ -0,0 +1,11 @@ +// run-pass +const C1: i32 = 0x12345678; +const C2: isize = C1 as i16 as isize; + +enum E { + V = C2 +} + +fn main() { + assert_eq!(C2 as u64, E::V as u64); +} diff --git a/tests/ui/issues/issue-9906.rs b/tests/ui/issues/issue-9906.rs new file mode 100644 index 000000000..a2870cf0f --- /dev/null +++ b/tests/ui/issues/issue-9906.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:issue-9906.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9906 as testmod; + +pub fn main() { + testmod::foo(); + testmod::FooBar::new(1); +} diff --git a/tests/ui/issues/issue-9918.rs b/tests/ui/issues/issue-9918.rs new file mode 100644 index 000000000..63ad7040d --- /dev/null +++ b/tests/ui/issues/issue-9918.rs @@ -0,0 +1,5 @@ +// run-pass + +pub fn main() { + assert_eq!((0 + 0u8) as char, '\0'); +} diff --git a/tests/ui/issues/issue-9942.rs b/tests/ui/issues/issue-9942.rs new file mode 100644 index 000000000..f48804465 --- /dev/null +++ b/tests/ui/issues/issue-9942.rs @@ -0,0 +1,6 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + const S: usize = 23 as usize; [0; S]; () +} diff --git a/tests/ui/issues/issue-9951.rs b/tests/ui/issues/issue-9951.rs new file mode 100644 index 000000000..2698a3b17 --- /dev/null +++ b/tests/ui/issues/issue-9951.rs @@ -0,0 +1,21 @@ +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] + +trait Bar { + fn noop(&self); +} +impl Bar for u8 { + fn noop(&self) {} +} + +fn main() { + let (a, b) = (&5u8 as &dyn Bar, &9u8 as &dyn Bar); + let (c, d): (&dyn Bar, &dyn Bar) = (a, b); + + let (a, b) = (Box::new(5u8) as Box<dyn Bar>, Box::new(9u8) as Box<dyn Bar>); + let (c, d): (&dyn Bar, &dyn Bar) = (&*a, &*b); + + let (c, d): (&dyn Bar, &dyn Bar) = (&5, &9); +} diff --git a/tests/ui/issues/issue-9968.rs b/tests/ui/issues/issue-9968.rs new file mode 100644 index 000000000..3ab90d99a --- /dev/null +++ b/tests/ui/issues/issue-9968.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:issue-9968.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9968 as lib; + +use lib::{Trait, Struct}; + +pub fn main() +{ + Struct::init().test(); +} diff --git a/tests/ui/issues/issue-99838.rs b/tests/ui/issues/issue-99838.rs new file mode 100644 index 000000000..2e81d5e82 --- /dev/null +++ b/tests/ui/issues/issue-99838.rs @@ -0,0 +1,40 @@ +// run-pass + +use std::hint; + +struct U16(u16); + +impl Drop for U16 { + fn drop(&mut self) { + // Prevent LLVM from optimizing away our alignment check. + assert!(hint::black_box(self as *mut U16 as usize) % 2 == 0); + } +} + +struct HasDrop; + +impl Drop for HasDrop { + fn drop(&mut self) {} +} + +struct Wrapper { + _a: U16, + b: HasDrop, +} + +#[repr(packed)] +struct Misalign(u8, Wrapper); + +fn main() { + let m = Misalign( + 0, + Wrapper { + _a: U16(10), + b: HasDrop, + }, + ); + // Put it somewhere definitely even (so the `a` field is definitely at an odd address). + let m: ([u16; 0], Misalign) = ([], m); + // Move out one field, so we run custom per-field drop logic below. + let _x = m.1.1.b; +} diff --git a/tests/ui/issues/issue-pr29383.rs b/tests/ui/issues/issue-pr29383.rs new file mode 100644 index 000000000..2bcc0aa27 --- /dev/null +++ b/tests/ui/issues/issue-pr29383.rs @@ -0,0 +1,14 @@ +enum E { + A, + B, +} + +fn main() { + match None { + None => {} + Some(E::A(..)) => {} + //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::A` + Some(E::B(..)) => {} + //~^ ERROR expected tuple struct or tuple variant, found unit variant `E::B` + } +} diff --git a/tests/ui/issues/issue-pr29383.stderr b/tests/ui/issues/issue-pr29383.stderr new file mode 100644 index 000000000..57783d75b --- /dev/null +++ b/tests/ui/issues/issue-pr29383.stderr @@ -0,0 +1,21 @@ +error[E0532]: expected tuple struct or tuple variant, found unit variant `E::A` + --> $DIR/issue-pr29383.rs:9:14 + | +LL | A, + | - `E::A` defined here +... +LL | Some(E::A(..)) => {} + | ^^^^^^^^ help: use this syntax instead: `E::A` + +error[E0532]: expected tuple struct or tuple variant, found unit variant `E::B` + --> $DIR/issue-pr29383.rs:11:14 + | +LL | B, + | - `E::B` defined here +... +LL | Some(E::B(..)) => {} + | ^^^^^^^^ help: use this syntax instead: `E::B` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0532`. |