Skip to content

Commit ae3a020

Browse files
authored
Rollup merge of rust-lang#150216 - reddevilmidzy:t13, r=Kivooeo
Tidying up tests/ui/issues 15 tests [6/N] > [!NOTE] > Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge. part of rust-lang#133895 r? Kivooeo
2 parents ad9e42b + 4578082 commit ae3a020

Some content is hidden

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

44 files changed

+198
-209
lines changed

tests/ui/array-slice-vec/array-break-length.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/ui/array-slice-vec/array-break-length.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/ui/issues/issue-36400.rs renamed to tests/ui/borrowck/borrow-immutable-deref-box.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! regression test for issue <https://github.com/rust-lang/rust/issues/36400>
12
fn f(x: &mut u32) {}
23

34
fn main() {

tests/ui/issues/issue-36400.stderr renamed to tests/ui/borrowck/borrow-immutable-deref-box.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable
2-
--> $DIR/issue-36400.rs:5:7
2+
--> $DIR/borrow-immutable-deref-box.rs:6:7
33
|
44
LL | f(&mut *x);
55
| ^^^^^^^ cannot borrow as mutable
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//! Test that `Box` cannot be used with a lifetime argument.
2+
//! regression test for issue <https://github.com/rust-lang/rust/issues/18423>
3+
4+
struct Foo<'a> {
5+
x: Box<'a, isize>,
6+
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
7+
}
8+
9+
fn main() {}

tests/ui/issues/issue-18423.stderr renamed to tests/ui/box/box-lifetime-argument-not-allowed.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
2-
--> $DIR/issue-18423.rs:4:8
2+
--> $DIR/box-lifetime-argument-not-allowed.rs:5:8
33
|
4-
LL | x: Box<'a, isize>
4+
LL | x: Box<'a, isize>,
55
| ^^^ -- help: remove the lifetime argument
66
| |
77
| expected 0 lifetime arguments

tests/ui/cast/cast-rfc0401-2.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/ui/cast/cast-rfc0401-2.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
1-
fn illegal_cast<U:?Sized,V:?Sized>(u: *const U) -> *const V
2-
{
1+
fn illegal_cast<U: ?Sized, V: ?Sized>(u: *const U) -> *const V {
32
u as *const V //~ ERROR is invalid
43
}
54

6-
fn illegal_cast_2<U:?Sized>(u: *const U) -> *const str
7-
{
5+
fn illegal_cast_2<U: ?Sized>(u: *const U) -> *const str {
86
u as *const str //~ ERROR is invalid
97
}
108

11-
trait Foo { fn foo(&self) {} }
9+
trait Foo {
10+
fn foo(&self) {}
11+
}
1212
impl<T> Foo for T {}
1313

14-
trait Bar { fn foo(&self) {} }
14+
trait Bar {
15+
fn foo(&self) {}
16+
}
1517
impl<T> Bar for T {}
1618

1719
enum E {
18-
A, B
20+
A,
21+
B,
1922
}
2023

21-
fn main()
22-
{
24+
struct Inches(i32);
25+
26+
fn main() {
2327
let f: f32 = 1.2;
2428
let v = core::ptr::null::<u8>();
25-
let fat_v : *const [u8] = unsafe { &*core::ptr::null::<[u8; 1]>()};
26-
let fat_sv : *const [i8] = unsafe { &*core::ptr::null::<[i8; 1]>()};
29+
let fat_v: *const [u8] = unsafe { &*core::ptr::null::<[u8; 1]>() };
30+
let fat_sv: *const [i8] = unsafe { &*core::ptr::null::<[i8; 1]>() };
2731
let foo: &dyn Foo = &f;
2832

2933
let _ = v as &u8; //~ ERROR non-primitive cast
@@ -39,6 +43,7 @@ fn main()
3943
let _ = 3_i32 as bool; //~ ERROR cannot cast
4044
let _ = E::A as bool; //~ ERROR cannot cast
4145
let _ = 0x61u32 as char; //~ ERROR can be cast as
46+
let _ = Inches as f32; //~ ERROR is invalid
4247

4348
let _ = false as f32; //~ ERROR is invalid
4449
let _ = E::A as f32; //~ ERROR is invalid
@@ -58,7 +63,7 @@ fn main()
5863
let _ = &f as *const f64; //~ ERROR is invalid
5964
let _ = fat_sv as usize; //~ ERROR is invalid
6065

61-
let a : *const str = "hello";
66+
let a: *const str = "hello";
6267
let _ = a as *const dyn Foo; //~ ERROR the size for values of type
6368

6469
// check no error cascade

0 commit comments

Comments
 (0)