Rollup merge of #149676 - reddevilmidzy:t10, r=Kivooeo
Tidying up tests/ui/issues tests [3/N] > [!NOTE] > Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge. part of rust-lang/rust#133895 r? Kivooeo
This commit is contained in:
commit
a76db5581b
24 changed files with 103 additions and 126 deletions
|
|
@ -2892,7 +2892,6 @@ ui/typeck/issue-105946.rs
|
|||
ui/typeck/issue-106929.rs
|
||||
ui/typeck/issue-107087.rs
|
||||
ui/typeck/issue-107775.rs
|
||||
ui/typeck/issue-10969.rs
|
||||
ui/typeck/issue-110017-format-into-help-deletes-macro.rs
|
||||
ui/typeck/issue-110052.rs
|
||||
ui/typeck/issue-112007-leaked-writeln-macro-internals.rs
|
||||
|
|
|
|||
8
tests/ui/closures/simple-capture-and-call.rs
Normal file
8
tests/ui/closures/simple-capture-and-call.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//! regression test for issue #1895
|
||||
//@ run-pass
|
||||
|
||||
fn main() {
|
||||
let x = 1_usize;
|
||||
let y = || x;
|
||||
let _z = y();
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for issue #2642
|
||||
//@ run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for issue #47673
|
||||
//@ check-pass
|
||||
#![allow(unused_imports)]
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
fn main() {
|
||||
let foo = "bar";
|
||||
let x = foo("baz");
|
||||
//~^ ERROR: expected function, found `&str`
|
||||
}
|
||||
|
||||
fn foo(file: &str) -> bool {
|
||||
true
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
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
|
||||
...
|
||||
LL | fn foo(file: &str) -> bool {
|
||||
| -------------------------- this function of the same name is available here, but it's shadowed by the local binding
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0618`.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
pub fn main() {
|
||||
let x = 1_usize;
|
||||
let y = || x;
|
||||
let _z = y();
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
use zoo::fly; //~ ERROR: function `fly` is private
|
||||
|
||||
mod zoo {
|
||||
fn fly() {}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
fly();
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
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 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0603`.
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
fn main() {
|
||||
let b = "hello";
|
||||
println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
|
||||
//~^ ERROR E0369
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
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 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0369`.
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for issue #3500
|
||||
//@ run-pass
|
||||
|
||||
pub fn main() {
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
//! regression test for issue #72933
|
||||
//@ build-pass
|
||||
// ignore-tidy-filelength
|
||||
#![crate_type="rlib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
fn banana(v: &str) -> u32 {
|
||||
match v {
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
//! regression test for issue #3993
|
||||
|
||||
mod a {
|
||||
fn f() {}
|
||||
}
|
||||
|
|
@ -5,3 +7,7 @@ mod a {
|
|||
fn main() {
|
||||
a::f(); //~ ERROR function `f` is private
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
use a::f; //~ ERROR function `f` is private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,27 @@
|
|||
error[E0603]: function `f` is private
|
||||
--> $DIR/private-item-simple.rs:6:8
|
||||
--> $DIR/private-item-simple.rs:12:12
|
||||
|
|
||||
LL | use a::f;
|
||||
| ^ private function
|
||||
|
|
||||
note: the function `f` is defined here
|
||||
--> $DIR/private-item-simple.rs:4:5
|
||||
|
|
||||
LL | fn f() {}
|
||||
| ^^^^^^
|
||||
|
||||
error[E0603]: function `f` is private
|
||||
--> $DIR/private-item-simple.rs:8:8
|
||||
|
|
||||
LL | a::f();
|
||||
| ^ private function
|
||||
|
|
||||
note: the function `f` is defined here
|
||||
--> $DIR/private-item-simple.rs:2:5
|
||||
--> $DIR/private-item-simple.rs:4:5
|
||||
|
|
||||
LL | fn f() {}
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0603`.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
//! regression test for issue #47377, #47380
|
||||
// ignore-tidy-tab
|
||||
fn main() {
|
||||
let b = "hello";
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0369]: cannot add `&str` to `&str`
|
||||
--> $DIR/issue-47377.rs:4:14
|
||||
--> $DIR/str-add-operator.rs:5:14
|
||||
|
|
||||
LL | let _a = b + ", World!";
|
||||
| - ^ ---------- &str
|
||||
|
|
@ -1,30 +1,30 @@
|
|||
//@ run-pass
|
||||
// regression test for issue #50825
|
||||
// Check that the feature gate normalizes associated types.
|
||||
//! regression test for issue #50825, #51044
|
||||
//! 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 Hello<A>
|
||||
where
|
||||
A: Animal,
|
||||
{
|
||||
}
|
||||
|
||||
trait Animal {
|
||||
type Noise;
|
||||
}
|
||||
|
||||
trait Loud<R> {
|
||||
}
|
||||
trait Loud<R> {}
|
||||
|
||||
impl Loud<Quack> for f32 {
|
||||
}
|
||||
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> {
|
||||
}
|
||||
impl Hello<Duck> for Foo<f32> where f32: Loud<<Duck as Animal>::Noise> {}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
//! regression test for issue #2151
|
||||
|
||||
fn main() {
|
||||
let x = panic!(); //~ ERROR type annotations needed
|
||||
x.clone();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0282]: type annotations needed
|
||||
--> $DIR/issue-2151.rs:2:9
|
||||
--> $DIR/never-type-inference-fail.rs:4:9
|
||||
|
|
||||
LL | let x = panic!();
|
||||
| ^
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
fn func(i: i32) {
|
||||
i(); //~ERROR expected function, found `i32`
|
||||
}
|
||||
fn main() {
|
||||
let i = 0i32;
|
||||
i(); //~ERROR expected function, found `i32`
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
error[E0618]: expected function, found `i32`
|
||||
--> $DIR/issue-10969.rs:2:5
|
||||
|
|
||||
LL | fn func(i: i32) {
|
||||
| - `i` has type `i32`
|
||||
LL | i();
|
||||
| ^--
|
||||
| |
|
||||
| call expression requires function
|
||||
|
||||
error[E0618]: expected function, found `i32`
|
||||
--> $DIR/issue-10969.rs:6:5
|
||||
|
|
||||
LL | let i = 0i32;
|
||||
| - `i` has type `i32`
|
||||
LL | i();
|
||||
| ^--
|
||||
| |
|
||||
| call expression requires function
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0618`.
|
||||
19
tests/ui/typeck/non-function-call-error.rs
Normal file
19
tests/ui/typeck/non-function-call-error.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
//! Regression test for issue #10969, #22468
|
||||
|
||||
fn main() {
|
||||
let foo = "bar";
|
||||
let x = foo("baz");
|
||||
//~^ ERROR: expected function, found `&str`
|
||||
|
||||
let i = 0i32;
|
||||
i();
|
||||
//~^ ERROR expected function, found `i32`
|
||||
}
|
||||
|
||||
fn foo(file: &str) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn func(i: i32) {
|
||||
i(); //~ERROR expected function, found `i32`
|
||||
}
|
||||
36
tests/ui/typeck/non-function-call-error.stderr
Normal file
36
tests/ui/typeck/non-function-call-error.stderr
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
error[E0618]: expected function, found `&str`
|
||||
--> $DIR/non-function-call-error.rs:5:13
|
||||
|
|
||||
LL | let foo = "bar";
|
||||
| --- `foo` has type `&str`
|
||||
LL | let x = foo("baz");
|
||||
| ^^^-------
|
||||
| |
|
||||
| call expression requires function
|
||||
...
|
||||
LL | fn foo(file: &str) -> bool {
|
||||
| -------------------------- this function of the same name is available here, but it's shadowed by the local binding
|
||||
|
||||
error[E0618]: expected function, found `i32`
|
||||
--> $DIR/non-function-call-error.rs:9:5
|
||||
|
|
||||
LL | let i = 0i32;
|
||||
| - `i` has type `i32`
|
||||
LL | i();
|
||||
| ^--
|
||||
| |
|
||||
| call expression requires function
|
||||
|
||||
error[E0618]: expected function, found `i32`
|
||||
--> $DIR/non-function-call-error.rs:18:5
|
||||
|
|
||||
LL | fn func(i: i32) {
|
||||
| - `i` has type `i32`
|
||||
LL | i();
|
||||
| ^--
|
||||
| |
|
||||
| call expression requires function
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0618`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue