Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions tests/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ Some traits' implementation must be compared with their definition, checking for

This subdirectory is *not* intended comparison traits (`PartialEq`, `Eq`, `PartialOrd`, `Ord`).

## `tests/ui/compile-flags/`

Tests for compile flags.

## `tests/ui/compiletest-self-test/`: compiletest "meta" tests

Meta test suite of the test harness `compiletest` itself.
Expand Down Expand Up @@ -548,6 +552,8 @@ A broad directory for tests on expressions.

Tests on the `extern` keyword and `extern` blocks and functions.

**FIXME**: Merge with `tests/ui/abi/extern`.

## `tests/ui/extern-flag/`: `--extern` command line flag

Tests for the `--extern` CLI flag.
Expand All @@ -556,6 +562,12 @@ Tests for the `--extern` CLI flag.

Tests on feature-gating, and the `#![feature(..)]` mechanism itself.

## `tests/ui/ffi/`: Foreign Function Interface

Tests for the `std::ffi` module.

See [`std::ffi`](https://doc.rust-lang.org/std/ffi/index.html)

## `tests/ui/ffi-attrs/`: `#![feature(ffi_const, ffi_pure)]`

The `#[ffi_const]` and `#[ffi_pure]` attributes applies clang's `const` and `pure` attributes to foreign functions declarations, respectively. These attributes are the core element of the tests in this category.
Expand Down Expand Up @@ -733,15 +745,9 @@ Various tests related to rejecting invalid inputs.

**FIXME**: This is rather uninformative, possibly rehome into more meaningful directories.

## `tests/ui/invalid-compile-flags/`

Tests for checking that invalid usage of compiler flags are rejected.

## `tests/ui/io-checks/`

Contains a single test. The test tries to output a file into an invalid directory with `-o`, then checks that the result is an error, not an internal compiler error.
## `tests/ui/io-checks/`: Input Output

**FIXME**: Rehome to invalid compiler flags maybe.
Tests for I/O related behaviour, covering stdout/stderr handling and error propagation.

## `tests/ui/issues/`: Tests directly related to GitHub issues

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! regression test for issue https://github.com/rust-lang/rust/issues/46472
fn bar<'a>() -> &'a mut u32 {
&mut 4
//~^ ERROR cannot return reference to temporary value [E0515]
}

fn main() { }
fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0515]: cannot return reference to temporary value
--> $DIR/issue-46472.rs:2:5
--> $DIR/return-ref-to-temporary.rs:3:5
|
LL | &mut 4
| ^^^^^-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
// reasonable examples) let to ambiguity errors about not being able
// to infer sufficient type information.


fn main() {
let n = 0;
let it = Some(1_usize).into_iter().inspect(|_| {n;});
let it = Some(1_usize).into_iter().inspect(|_| {
n;
});
}
5 changes: 5 additions & 0 deletions tests/ui/closures/nested-closure-call.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! regression test for https://github.com/rust-lang/rust/issues/24779
//@ run-pass
fn main() {
assert_eq!((|| || 42)()(), 42);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there a directory for tests that test a CLI options passed to compiler like in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was an invalid-compile-flags directory, but no directory like run-pass compile flags

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do tests/ui/compile-flags and split it into ui/compile-flags/invalid/ and ui/compile-flags/run-pass/

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! regression test for https://github.com/rust-lang/rust/issues/24945
//@ run-pass
// This test is just checking that we continue to accept `-g -g -O -O`
// as options to the compiler.
Expand Down
9 changes: 9 additions & 0 deletions tests/ui/enum/enum-variant-no-field.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//! regression test for https://github.com/rust-lang/rust/issues/23253
enum Foo {
Bar,
}

fn main() {
Foo::Bar.a;
//~^ ERROR no field `a` on type `Foo`
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0609]: no field `a` on type `Foo`
--> $DIR/issue-23253.rs:4:14
--> $DIR/enum-variant-no-field.rs:7:14
|
LL | Foo::Bar.a;
| ^ unknown field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! regression test for issue https://github.com/rust-lang/rust/issues/50442
//@ run-pass
#![allow(dead_code)]
enum Void {}

enum Foo {
A(i32),
B(Void),
C(i32)
C(i32),
}

fn main() {
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/expr/return-in-block-tuple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//! regression test for https://github.com/rust-lang/rust/issues/18110
//@ run-pass
#![allow(unreachable_code)]

fn main() {
({ return },);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Regression test for https://github.com/rust-lang/rust/issues/19398
//@ check-pass

trait T {
Expand Down
5 changes: 5 additions & 0 deletions tests/ui/fmt/println-float.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! regression test for https://github.com/rust-lang/rust/issues/11382
//@ run-pass
fn main() {
println!("{}", 1.2);
}
6 changes: 6 additions & 0 deletions tests/ui/indexing/ref-array-indexing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//! regression test for https://github.com/rust-lang/rust/issues/43205
//@ run-pass
fn main() {
let _ = &&[()][0];
println!("{:?}", &[(), ()][1]);
}
3 changes: 0 additions & 3 deletions tests/ui/issues/issue-10656.rs

This file was deleted.

4 changes: 0 additions & 4 deletions tests/ui/issues/issue-11382.rs

This file was deleted.

5 changes: 0 additions & 5 deletions tests/ui/issues/issue-17001.rs

This file was deleted.

7 changes: 0 additions & 7 deletions tests/ui/issues/issue-17450.rs

This file was deleted.

6 changes: 0 additions & 6 deletions tests/ui/issues/issue-18110.rs

This file was deleted.

3 changes: 0 additions & 3 deletions tests/ui/issues/issue-18159.rs

This file was deleted.

7 changes: 0 additions & 7 deletions tests/ui/issues/issue-18532.rs

This file was deleted.

5 changes: 0 additions & 5 deletions tests/ui/issues/issue-20772.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/issues/issue-21177.rs

This file was deleted.

10 changes: 0 additions & 10 deletions tests/ui/issues/issue-21291.rs

This file was deleted.

6 changes: 0 additions & 6 deletions tests/ui/issues/issue-21449.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/issues/issue-21449.stderr

This file was deleted.

5 changes: 0 additions & 5 deletions tests/ui/issues/issue-23189.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/issues/issue-23189.stderr

This file was deleted.

6 changes: 0 additions & 6 deletions tests/ui/issues/issue-23253.rs

This file was deleted.

4 changes: 0 additions & 4 deletions tests/ui/issues/issue-24779.rs

This file was deleted.

5 changes: 0 additions & 5 deletions tests/ui/issues/issue-43205.rs

This file was deleted.

12 changes: 0 additions & 12 deletions tests/ui/issues/issue-4968.rs

This file was deleted.

20 changes: 0 additions & 20 deletions tests/ui/issues/issue-4968.stderr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Test that regionck suggestions in a provided method of a trait
// don't ICE
//! regression test for https://github.com/rust-lang/rust/issues/17758
//! Test that regionck suggestions in a provided method of a trait
//! don't ICE

trait Foo<'a> {
fn foo(&'a self);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-17758.rs:7:9
--> $DIR/trait-method-lifetime-suggestion.rs:8:9
|
LL | trait Foo<'a> {
| -- lifetime `'a` defined here
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/lint/lint-missing-doc-crate-attr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// regression test for https://github.com/rust-lang/rust/issues/10656
#![deny(missing_docs)]
//~^ ERROR missing documentation for the crate
#![crate_type = "lib"]
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
error: missing documentation for the crate
--> $DIR/issue-10656.rs:1:1
--> $DIR/lint-missing-doc-crate-attr.rs:2:1
|
LL | / #![deny(missing_docs)]
LL | | #![crate_type="lib"]
| |____________________^
LL | |
LL | | #![crate_type = "lib"]
| |______________________^
|
note: the lint level is defined here
--> $DIR/issue-10656.rs:1:9
--> $DIR/lint-missing-doc-crate-attr.rs:2:9
|
LL | #![deny(missing_docs)]
| ^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: missing documentation for the crate
--> $DIR/lint-missing-doc-crate.rs:4:47
--> $DIR/lint-missing-doc-crate-flags.rs:4:47
|
LL |
| ^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! regression test for https://github.com/rust-lang/rust/issues/19734
fn main() {}

struct Type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: cannot find macro `undef` in this scope
--> $DIR/issue-19734.rs:6:5
--> $DIR/undefined-macro-in-impl.rs:7:5
|
LL | undef!();
| ^^^^^
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/match/match-const-tuple-type-mismatch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! Regression test for issue https://github.com/rust-lang/rust/issues/4968
//@ dont-require-annotations: NOTE

const A: (isize, isize) = (4, 2);
fn main() {
match 42 {
A => (),
//~^ ERROR mismatched types
//~| NOTE expected type `{integer}`
//~| NOTE found tuple `(isize, isize)`
//~| NOTE expected integer, found `(isize, isize)`
}
}
21 changes: 21 additions & 0 deletions tests/ui/match/match-const-tuple-type-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0308]: mismatched types
--> $DIR/match-const-tuple-type-mismatch.rs:7:9
|
LL | const A: (isize, isize) = (4, 2);
| ----------------------- constant defined here
LL | fn main() {
LL | match 42 {
| -- this expression has type `{integer}`
LL | A => (),
| ^
| |
| expected integer, found `(isize, isize)`
| `A` is interpreted as a constant, not a new binding
| help: introduce a new binding instead: `other_a`
|
= note: expected type `{integer}`
found tuple `(isize, isize)`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0308`.
Loading
Loading