Skip to content

Commit d746230

Browse files
committed
tests: add #![rustc_no_implicit_bounds]
After reviewing all tests with `?Sized`, these tests seem like they could probably benefit from `#![rustc_no_implicit_bounds]`. - Skipping most of `tests/ui/unsized` as these seem to want to test `?Sized` - Skipping tests that used `Box<T>` because it's still bound by `T: MetaSized` - Skipping parsing or other tests that cared about `?Sized` syntactically - Skipping tests for `derive(CoercePointee)` because this appears to check that the pointee type is relaxed with `?Sized` explicitly
1 parent 01915a7 commit d746230

File tree

92 files changed

+507
-394
lines changed

Some content is hidden

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

92 files changed

+507
-394
lines changed

tests/ui/cast/cast-rfc0401-vtable-kinds.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
//@ run-pass
2+
3+
#![feature(rustc_attrs)]
4+
#![rustc_no_implicit_bounds]
5+
26
// Check that you can cast between different pointers to trait objects
37
// whose vtable have the same kind (both lengths, or both trait pointers).
48

@@ -9,11 +13,11 @@ trait Bar { //~ WARN trait `Bar` is never used
913
impl Bar for () {}
1014

1115
#[repr(C)]
12-
struct FooS<T:?Sized>(T);
16+
struct FooS<T>(T);
1317
#[repr(C)]
14-
struct BarS<T:?Sized>(T);
18+
struct BarS<T>(T);
1519

16-
fn foo_to_bar<T:?Sized>(u: *const FooS<T>) -> *const BarS<T> {
20+
fn foo_to_bar<T>(u: *const FooS<T>) -> *const BarS<T> {
1721
u as *const BarS<T>
1822
}
1923

tests/ui/cast/cast-rfc0401-vtable-kinds.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: trait `Bar` is never used
2-
--> $DIR/cast-rfc0401-vtable-kinds.rs:5:7
2+
--> $DIR/cast-rfc0401-vtable-kinds.rs:9:7
33
|
44
LL | trait Bar {
55
| ^^^

tests/ui/cast/ptr-to-trait-obj-different-regions-id-trait.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/ptr-to-trait-obj-different-regions-id-trait.rs:24:27
2+
--> $DIR/ptr-to-trait-obj-different-regions-id-trait.rs:26:27
33
|
44
LL | fn m<'a>() {
55
| -- lifetime `'a` defined here

tests/ui/cast/ptr-to-trait-obj-different-regions-id-trait.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/ptr-to-trait-obj-different-regions-id-trait.rs:24:27
2+
--> $DIR/ptr-to-trait-obj-different-regions-id-trait.rs:26:27
33
|
44
LL | fn m<'a>() {
55
| -- lifetime `'a` defined here

tests/ui/cast/ptr-to-trait-obj-different-regions-id-trait.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
//@ ignore-compare-mode-next-solver (explicit revisions)
33
//@[next] compile-flags: -Znext-solver
44
//@ check-fail
5-
//
5+
#![feature(rustc_attrs)]
6+
#![rustc_no_implicit_bounds]
7+
68
// Make sure we can't trick the compiler by using a projection.
79

810
trait Cat<'a> {}
911
impl Cat<'_> for () {}
1012

1113
trait Id {
12-
type Id: ?Sized;
14+
type Id;
1315
}
14-
impl<T: ?Sized> Id for T {
16+
impl<T> Id for T {
1517
type Id = T;
1618
}
1719

18-
struct S<T: ?Sized> {
20+
struct S<T> {
1921
tail: <T as Id>::Id,
2022
}
2123

tests/ui/coercion/codegen-smart-pointer-with-alias.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@
88
// system, which isn't guaranteed to be normalized after substitution.
99

1010
#![feature(coerce_unsized)]
11+
#![feature(rustc_attrs)]
12+
#![rustc_no_implicit_bounds]
1113

1214
use std::ops::CoerceUnsized;
1315

1416
trait Mirror {
15-
type Assoc: ?Sized;
17+
type Assoc;
1618
}
17-
impl<T: ?Sized> Mirror for T {
19+
impl<T> Mirror for T {
1820
type Assoc = T;
1921
}
2022

2123
trait Any {}
2224
impl<T> Any for T {}
2325

24-
struct Signal<'a, T: ?Sized>(<&'a T as Mirror>::Assoc);
26+
struct Signal<'a, T>(<&'a T as Mirror>::Assoc);
2527

2628
// This `CoerceUnsized` impl isn't special; it's a bit more restricted than we'd see in the wild,
2729
// but this ICE also reproduces if we were to make it general over `Signal<T> -> Signal<U>`.

tests/ui/coercion/issue-26905-rpass.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
//@ run-pass
22
#![feature(unsize, coerce_unsized)]
3+
#![feature(rustc_attrs)]
4+
#![rustc_no_implicit_bounds]
35

46
// Verfies that PhantomData is ignored for DST coercions
57

68
use std::marker::{Unsize, PhantomData};
79
use std::ops::CoerceUnsized;
810

9-
struct MyRc<T: ?Sized> {
11+
struct MyRc<T> {
1012
_ptr: *const T,
1113
_boo: PhantomData<T>,
1214
}
1315

14-
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ }
16+
impl<T: Unsize<U>, U> CoerceUnsized<MyRc<U>> for MyRc<T>{ }
1517

1618
fn main() {
1719
let data = [1, 2, 3];

tests/ui/coercion/issue-26905.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#![feature(unsize, coerce_unsized)]
2+
#![feature(rustc_attrs)]
3+
#![rustc_no_implicit_bounds]
24

35
// Verfies that non-PhantomData ZSTs still cause coercions to fail.
46
// They might have additional semantics that we don't want to bulldoze.
57

68
use std::marker::{Unsize, PhantomData};
79
use std::ops::CoerceUnsized;
810

9-
struct NotPhantomData<T: ?Sized>(PhantomData<T>);
11+
struct NotPhantomData<T>(PhantomData<T>);
1012

11-
struct MyRc<T: ?Sized> {
13+
struct MyRc<T> {
1214
_ptr: *const T,
1315
_boo: NotPhantomData<T>,
1416
}
1517

16-
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } //~ERROR
18+
impl<T: Unsize<U>, U> CoerceUnsized<MyRc<U>> for MyRc<T>{ } //~ERROR
1719

1820
fn main() {
1921
let data = [1, 2, 3];

tests/ui/coercion/issue-26905.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0375]: implementing `CoerceUnsized` does not allow multiple fields to be coerced
2-
--> $DIR/issue-26905.rs:16:40
2+
--> $DIR/issue-26905.rs:18:23
33
|
4-
LL | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ }
5-
| ^^^^^^^^^^^^^^^^^^^^^^
4+
LL | impl<T: Unsize<U>, U> CoerceUnsized<MyRc<U>> for MyRc<T>{ }
5+
| ^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: the trait `CoerceUnsized` may only be implemented when a single field is being coerced
8-
--> $DIR/issue-26905.rs:12:5
8+
--> $DIR/issue-26905.rs:14:5
99
|
1010
LL | _ptr: *const T,
1111
| ^^^^^^^^^^^^^^

tests/ui/coercion/sub-principals.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
// a non-higer-ranked instantiation.
88

99
#![feature(unsize)]
10+
#![feature(rustc_attrs)]
11+
#![rustc_no_implicit_bounds]
1012

1113
use std::marker::Unsize;
1214

13-
fn test<T: ?Sized, U: ?Sized>()
15+
fn test<T, U>()
1416
where
1517
T: Unsize<U>,
1618
{

0 commit comments

Comments
 (0)