Skip to content

Commit edafbaf

Browse files
committed
Adjust UI tests for unit_bindings
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
1 parent 37998ab commit edafbaf

File tree

61 files changed

+117
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+117
-117
lines changed

tests/ui/assign-assign.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn test_assign() {
66
let y: () = x = 10;
77
assert_eq!(x, 10);
88
assert_eq!(y, ());
9-
let mut z = x = 11;
9+
let mut z: () = x = 11;
1010
assert_eq!(x, 11);
1111
assert_eq!(z, ());
1212
z = x = 12;
@@ -19,7 +19,7 @@ fn test_assign_op() {
1919
let y: () = x += 10;
2020
assert_eq!(x, 10);
2121
assert_eq!(y, ());
22-
let mut z = x += 11;
22+
let mut z: () = x += 11;
2323
assert_eq!(x, 21);
2424
assert_eq!(z, ());
2525
z = x += 12;

tests/ui/associated-type-bounds/dyn-impl-trait-type.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ fn def_et4() -> Et4 {
5959
pub fn use_et4() { assert_forall_tr2(def_et4().mk()); }
6060

6161
fn main() {
62-
let _ = use_et1();
63-
let _ = use_et2();
64-
let _ = use_et3();
65-
let _ = use_et4();
62+
use_et1();
63+
use_et2();
64+
use_et3();
65+
use_et4();
6666
}

tests/ui/associated-type-bounds/dyn-rpit-and-let.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ fn def_et4() -> Box<dyn Tr1<As1: for<'a> Tr2<'a>>> {
6666
pub fn use_et4() { assert_forall_tr2(def_et4().mk()); }
6767

6868
fn main() {
69-
let _ = use_et1();
70-
let _ = use_et2();
71-
let _ = use_et3();
72-
let _ = use_et4();
69+
use_et1();
70+
use_et2();
71+
use_et3();
72+
use_et4();
7373
}

tests/ui/associated-type-bounds/rpit.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ fn def_et4() -> impl Tr1<As1: for<'a> Tr2<'a>> {
5757
pub fn use_et4() { assert_forall_tr2(def_et4().mk()); }
5858

5959
fn main() {
60-
let _ = use_et1();
61-
let _ = use_et2();
62-
let _ = use_et3();
63-
let _ = use_et4();
60+
use_et1();
61+
use_et2();
62+
use_et3();
63+
use_et4();
6464
}

tests/ui/associated-type-bounds/trait-alias-impl-trait.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ pub fn use_et4() {
8989
}
9090

9191
fn main() {
92-
let _ = use_et1();
93-
let _ = use_et2();
94-
let _ = use_et3();
95-
let _ = use_et4();
92+
use_et1();
93+
use_et2();
94+
use_et3();
95+
use_et4();
9696
}

tests/ui/associated-types/normalization-debruijn-3.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
use std::future::{Future, Ready};
88
async fn read() {
9-
let _ = connect(&()).await;
9+
connect(&()).await;
1010
}
1111
async fn connect<A: ToSocketAddr>(addr: A) {
12-
let _ = addr.to_socket_addr().await;
12+
addr.to_socket_addr().await;
1313
}
1414
pub trait ToSocketAddr {
1515
type Future: Future<Output = ()>;

tests/ui/async-await/drop-track-field-assign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl Agent {
2121
let mut info = self.info_result.clone();
2222
info.node = Some("bar".into());
2323
let element = parse_info(info);
24-
let _ = send_element(element).await;
24+
send_element(element).await;
2525
}
2626
}
2727

tests/ui/async-await/field-assign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl Agent {
2121
let mut info = self.info_result.clone();
2222
info.node = Some("bar".into());
2323
let element = parse_info(info);
24-
let _ = send_element(element).await;
24+
send_element(element).await;
2525
}
2626
}
2727

tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ LL | pub fn foo() -> impl Future + Send {
66
|
77
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
88
note: future is not `Send` as this value is used across an await
9-
--> $DIR/issue-64130-4-async-move.rs:27:32
9+
--> $DIR/issue-64130-4-async-move.rs:27:23
1010
|
1111
LL | match client.status() {
1212
| ------ has type `&Client` which is not `Send`
1313
LL | 200 => {
14-
LL | let _x = get().await;
15-
| ^^^^^ await occurs here, with `client` maybe used later
14+
LL | get().await;
15+
| ^^^^^ await occurs here, with `client` maybe used later
1616
...
1717
LL | }
1818
| - `client` is later dropped here

tests/ui/async-await/issue-64130-4-async-move.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn foo() -> impl Future + Send {
2424
async move {
2525
match client.status() {
2626
200 => {
27-
let _x = get().await;
27+
get().await;
2828
}
2929
_ => (),
3030
}

tests/ui/async-await/non-trivial-drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![feature(generators)]
88

99
fn main() {
10-
let _ = foo();
10+
foo();
1111
}
1212

1313
fn foo() {

tests/ui/cfg/cfg_stmt_expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn main() {
8181
// check that lints work
8282

8383
#[allow(non_snake_case)]
84-
let FOOBAR = {
84+
let FOOBAR: () = {
8585
fn SYLADEX() {}
8686
};
8787

tests/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct Struct {
1515
fn main() {
1616
let mut s = Struct { x: 10, y: 10, s: String::new() };
1717

18-
let mut c = {
18+
let mut c = || {
1919
s.x += 10;
2020
s.y += 42;
2121
s.s = String::from("new");

tests/ui/const-generics/generic_const_exprs/issue-86710.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::marker::PhantomData;
77

88
fn main() {
99
let x = FooImpl::<BarImpl<1>> { phantom: PhantomData };
10-
let _ = x.foo::<BarImpl<1>>();
10+
x.foo::<BarImpl<1>>();
1111
}
1212

1313
trait Foo<T>

tests/ui/const-generics/issues/issue-70273-assoc-fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ impl T<0usize> for S {
1010
}
1111

1212
fn main() {
13-
let _err = <S as T<0usize>>::f();
13+
<S as T<0usize>>::f();
1414
}

tests/ui/consts/assoc_const_generic_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trait ZeroSized: Sized {
88
impl<T: Sized> ZeroSized for T {
99
const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; //~ ERROR evaluation of `<u32 as ZeroSized>::I_AM_ZERO_SIZED` failed
1010
fn requires_zero_size(self) {
11-
let () = Self::I_AM_ZERO_SIZED;
11+
Self::I_AM_ZERO_SIZED;
1212
println!("requires_zero_size called");
1313
}
1414
}

tests/ui/consts/const-eval/erroneous-const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const fn no_codegen<T>() {
1010
if false {
1111
// This bad constant is only used in dead code in a no-codegen function... and yet we still
1212
// must make sure that the build fails.
13-
let _ = PrintName::<T>::VOID; //~ constant
13+
PrintName::<T>::VOID; //~ constant
1414
}
1515
}
1616

tests/ui/consts/const-eval/erroneous-const.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | const VOID: () = [()][2];
55
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
66

77
note: erroneous constant used
8-
--> $DIR/erroneous-const.rs:13:17
8+
--> $DIR/erroneous-const.rs:13:13
99
|
10-
LL | let _ = PrintName::<T>::VOID;
11-
| ^^^^^^^^^^^^^^^^^^^^
10+
LL | PrintName::<T>::VOID;
11+
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: aborting due to previous error
1414

tests/ui/consts/const-eval/erroneous-const2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub static FOO: () = {
1010
if false {
1111
// This bad constant is only used in dead code in a static initializer... and yet we still
1212
// must make sure that the build fails.
13-
let _ = PrintName::<i32>::VOID; //~ constant
13+
PrintName::<i32>::VOID; //~ constant
1414
}
1515
};
1616

tests/ui/consts/const-eval/erroneous-const2.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | const VOID: () = [()][2];
55
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
66

77
note: erroneous constant used
8-
--> $DIR/erroneous-const2.rs:13:17
8+
--> $DIR/erroneous-const2.rs:13:9
99
|
10-
LL | let _ = PrintName::<i32>::VOID;
11-
| ^^^^^^^^^^^^^^^^^^^^^^
10+
LL | PrintName::<i32>::VOID;
11+
| ^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: aborting due to previous error
1414

tests/ui/consts/const-eval/promoted_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ const Y: () = {
4848
};
4949

5050
fn main() {
51-
let _y = Y;
51+
Y;
5252
}

tests/ui/consts/const-eval/unwind-abort.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ const _: () = foo();
88
// Ensure that the CTFE engine handles calls to `extern "C"` aborting gracefully
99

1010
fn main() {
11-
let _ = foo();
11+
foo();
1212
}

tests/ui/consts/large_const_alloc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ static FOO2: () = {
1313
};
1414

1515
fn main() {
16-
let _ = FOO;
17-
let _ = FOO2;
16+
FOO;
17+
FOO2;
1818
}

tests/ui/empty-allocation-rvalue-non-null.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
// pretty-expanded FIXME #23616
55

66
pub fn main() {
7-
let x = *Box::new(());
7+
let x: () = *Box::new(());
88
}

tests/ui/feature-gates/feature-gate-generic_arg_infer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ fn bar() {
1919
fn main() {
2020
let _x = foo::<_>([1,2]);
2121
//[normal]~^ ERROR: type provided when a constant was expected
22-
let _y = bar();
22+
bar();
2323
}

tests/ui/for-loop-while/loop-break-value.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn main() {
6464
};
6565
assert_eq!(trait_unified_3, ["Yes"]);
6666

67-
let regular_break = loop {
67+
let regular_break: () = loop {
6868
if true {
6969
break;
7070
} else {
@@ -73,7 +73,7 @@ pub fn main() {
7373
};
7474
assert_eq!(regular_break, ());
7575

76-
let regular_break_2 = loop {
76+
let regular_break_2: () = loop {
7777
if true {
7878
break Default::default();
7979
} else {
@@ -82,7 +82,7 @@ pub fn main() {
8282
};
8383
assert_eq!(regular_break_2, ());
8484

85-
let regular_break_3 = loop {
85+
let regular_break_3: () = loop {
8686
break if true {
8787
Default::default()
8888
} else {
@@ -91,13 +91,13 @@ pub fn main() {
9191
};
9292
assert_eq!(regular_break_3, ());
9393

94-
let regular_break_4 = loop {
94+
let regular_break_4: () = loop {
9595
break ();
9696
break;
9797
};
9898
assert_eq!(regular_break_4, ());
9999

100-
let regular_break_5 = loop {
100+
let regular_break_5: () = loop {
101101
break;
102102
break ();
103103
};

tests/ui/generics/post_monomorphization_error_backtrace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn assert_zst<T>() {
1111
//~| NOTE: in this expansion of assert!
1212
//~| NOTE: the evaluated program panicked
1313
}
14-
let _ = F::<T>::V;
14+
F::<T>::V;
1515
}
1616

1717
fn foo<U>() {

tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-6.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, 'b, U: Unpack<'b>> Backed<'a, U> {
7171
where
7272
F: for<'f> FnOnce(<U as Unpack<'f>>::Unpacked) -> (),
7373
{
74-
let result = f(self.1.unpack());
74+
let result: () = f(self.1.unpack());
7575
Backed(self.0, result)
7676
}
7777
}

tests/ui/intrinsics/panic-uninitialized-zeroed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ fn main() {
391391
let _val = mem::zeroed::<ZeroIsValid>();
392392
let _val = mem::uninitialized::<MaybeUninit<bool>>();
393393
let _val = mem::uninitialized::<[!; 0]>();
394-
let _val = mem::uninitialized::<()>();
394+
let _val: () = mem::uninitialized::<()>();
395395
let _val = mem::uninitialized::<ZeroSized>();
396396
}
397397
}

tests/ui/issues/issue-11047.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pub mod foo {
1818
fn main() {
1919

2020
type Ham = foo::bar::baz::Qux;
21-
let foo = foo::bar::baz::Qux::new(); // invoke directly
22-
let bar = Ham::new(); // invoke via type alias
21+
let foo: () = foo::bar::baz::Qux::new(); // invoke directly
22+
let bar: () = Ham::new(); // invoke via type alias
2323

2424
type StringVec = Vec<String>;
2525
let sv = StringVec::new();

tests/ui/issues/issue-11709.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct S {x:()}
1010

1111
fn test(slot: &mut Option<Box<dyn FnMut() -> Box<dyn FnMut()>>>) -> () {
1212
let a = slot.take();
13-
let _a = match a {
13+
let _a: () = match a {
1414
// `{let .. a(); }` would break
1515
Some(mut a) => { let _a = a(); },
1616
None => (),
@@ -28,7 +28,7 @@ fn not(b: bool) -> bool {
2828

2929
pub fn main() {
3030
// {} would break
31-
let _r = {};
31+
let _r: () = {};
3232
let mut slot = None;
3333
// `{ test(...); }` would break
3434
let _s : S = S{ x: { test(&mut slot); } };

tests/ui/issues/issue-11740.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ impl Element {
2424

2525
fn main() {
2626
let element = Element { attrs: Vec::new() };
27-
let _ = unsafe { element.get_attr("foo") };
27+
unsafe { let () = element.get_attr("foo"); };
2828
}

tests/ui/issues/issue-20644.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn foo() {
2626
let cwd = env::current_dir().unwrap();
2727
let src = cwd.clone();
2828
let summary = File::open(&src.join("SUMMARY.md")).unwrap();
29-
let _ = parse_summary(summary, &src);
29+
parse_summary(summary, &src);
3030
}
3131

3232
fn main() {}

tests/ui/issues/issue-23808.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ impl_Const!(ConstStruct, ConstEnum, AliasedConstStruct, AliasedConstEnum);
4545
impl_StaticFn!(StaticFnStruct, StaticFnEnum, AliasedStaticFnStruct, AliasedStaticFnEnum);
4646

4747
fn main() {
48-
let _ = ConstStruct::C;
49-
let _ = ConstEnum::C;
48+
let () = ConstStruct::C;
49+
let () = ConstEnum::C;
5050

5151
StaticFnStruct::sfn();
5252
StaticFnEnum::sfn();
5353

54-
let _ = AliasConstStruct::C;
55-
let _ = AliasConstEnum::C;
54+
let () = AliasConstStruct::C;
55+
let () = AliasConstEnum::C;
5656

5757
AliasStaticFnStruct::sfn();
5858
AliasStaticFnEnum::sfn();

0 commit comments

Comments
 (0)