diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-02-17 00:19:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-17 00:19:35 +0100 |
| commit | ee07df9c505232e997fe01783202305ed5ca9680 (patch) | |
| tree | 153bb37c5abb096d5e32582abde3a80b3de859f1 /tests/ui/issues | |
| parent | 42f2303c67d8324f711f56426e4f00054cfbcc9e (diff) | |
| parent | d75e43c37137c1df80d5fee19eee19803918bd44 (diff) | |
| download | rust-ee07df9c505232e997fe01783202305ed5ca9680.tar.gz rust-ee07df9c505232e997fe01783202305ed5ca9680.zip | |
Rollup merge of #108009 - c410-f3r:moar-tests, r=petrochenkov
Move some tests r? `@petrochenkov`
Diffstat (limited to 'tests/ui/issues')
25 files changed, 0 insertions, 630 deletions
diff --git a/tests/ui/issues/issue-22536-copy-mustnt-zero.rs b/tests/ui/issues/issue-22536-copy-mustnt-zero.rs deleted file mode 100644 index 017f36484c1..00000000000 --- a/tests/ui/issues/issue-22536-copy-mustnt-zero.rs +++ /dev/null @@ -1,28 +0,0 @@ -// 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-2735-2.rs b/tests/ui/issues/issue-2735-2.rs deleted file mode 100644 index 70ebce9d35a..00000000000 --- a/tests/ui/issues/issue-2735-2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// 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 deleted file mode 100644 index 23301537835..00000000000 --- a/tests/ui/issues/issue-2735-3.rs +++ /dev/null @@ -1,27 +0,0 @@ -// 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 deleted file mode 100644 index 20d3949a9f9..00000000000 --- a/tests/ui/issues/issue-2735.rs +++ /dev/null @@ -1,22 +0,0 @@ -// 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-27583.rs b/tests/ui/issues/issue-27583.rs deleted file mode 100644 index 84c94c7c905..00000000000 --- a/tests/ui/issues/issue-27583.rs +++ /dev/null @@ -1,47 +0,0 @@ -// 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-33903.rs b/tests/ui/issues/issue-33903.rs deleted file mode 100644 index 613aa121a47..00000000000 --- a/tests/ui/issues/issue-33903.rs +++ /dev/null @@ -1,10 +0,0 @@ -// 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-38821.rs b/tests/ui/issues/issue-38821.rs deleted file mode 100644 index 6753860e9ff..00000000000 --- a/tests/ui/issues/issue-38821.rs +++ /dev/null @@ -1,33 +0,0 @@ -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 deleted file mode 100644 index a52a9c138f1..00000000000 --- a/tests/ui/issues/issue-38821.stderr +++ /dev/null @@ -1,22 +0,0 @@ -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-39292.rs b/tests/ui/issues/issue-39292.rs deleted file mode 100644 index 968cf08916f..00000000000 --- a/tests/ui/issues/issue-39292.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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-40003.rs b/tests/ui/issues/issue-40003.rs deleted file mode 100644 index 5e61361f987..00000000000 --- a/tests/ui/issues/issue-40003.rs +++ /dev/null @@ -1,178 +0,0 @@ -// 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-48179.rs b/tests/ui/issues/issue-48179.rs deleted file mode 100644 index f81203dc412..00000000000 --- a/tests/ui/issues/issue-48179.rs +++ /dev/null @@ -1,38 +0,0 @@ -// 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-50576.rs b/tests/ui/issues/issue-50576.rs deleted file mode 100644 index e0c36b8273a..00000000000 --- a/tests/ui/issues/issue-50576.rs +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 4ec22fde910..00000000000 --- a/tests/ui/issues/issue-50576.stderr +++ /dev/null @@ -1,22 +0,0 @@ -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-53712.rs b/tests/ui/issues/issue-53712.rs deleted file mode 100644 index 2353904d79d..00000000000 --- a/tests/ui/issues/issue-53712.rs +++ /dev/null @@ -1,9 +0,0 @@ -// 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 deleted file mode 100644 index db85919afcb..00000000000 --- a/tests/ui/issues/issue-53712.stderr +++ /dev/null @@ -1,11 +0,0 @@ -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-54582.rs b/tests/ui/issues/issue-54582.rs deleted file mode 100644 index 8c50cac67f8..00000000000 --- a/tests/ui/issues/issue-54582.rs +++ /dev/null @@ -1,16 +0,0 @@ -// 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-75307.rs b/tests/ui/issues/issue-75307.rs deleted file mode 100644 index cffa6bea8ed..00000000000 --- a/tests/ui/issues/issue-75307.rs +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index c5b0b11e7d0..00000000000 --- a/tests/ui/issues/issue-75307.stderr +++ /dev/null @@ -1,8 +0,0 @@ -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-75777.rs b/tests/ui/issues/issue-75777.rs deleted file mode 100644 index a1e438bc617..00000000000 --- a/tests/ui/issues/issue-75777.rs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 deleted file mode 100644 index 370cd72fd55..00000000000 --- a/tests/ui/issues/issue-75777.stderr +++ /dev/null @@ -1,11 +0,0 @@ -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-7813.rs b/tests/ui/issues/issue-7813.rs deleted file mode 100644 index ce549bde601..00000000000 --- a/tests/ui/issues/issue-7813.rs +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 2a747f679a8..00000000000 --- a/tests/ui/issues/issue-7813.stderr +++ /dev/null @@ -1,14 +0,0 @@ -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-83924.fixed b/tests/ui/issues/issue-83924.fixed deleted file mode 100644 index aa40da12b87..00000000000 --- a/tests/ui/issues/issue-83924.fixed +++ /dev/null @@ -1,20 +0,0 @@ -// 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 deleted file mode 100644 index 22b80fe2f38..00000000000 --- a/tests/ui/issues/issue-83924.rs +++ /dev/null @@ -1,20 +0,0 @@ -// 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 deleted file mode 100644 index 572414df2bf..00000000000 --- a/tests/ui/issues/issue-83924.stderr +++ /dev/null @@ -1,22 +0,0 @@ -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`. |
