Skip to content

Commit 0531eb5

Browse files
committed
fix some auto_trait tests by removing the DynSized bound
auto traits cannot have bounds, so they must remove the implicit DynSized bound with `Self: ?DynSized`
1 parent 136cd10 commit 0531eb5

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/test/compile-fail/auto-impl-future-compat.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(optin_builtin_traits)]
11+
#![feature(optin_builtin_traits, dynsized)]
1212

13-
trait Foo {}
13+
use std::marker::DynSized;
14+
15+
trait Foo: ?DynSized {}
1416
impl Foo for .. {}
1517
//~^ ERROR The form `impl Foo for .. {}` will be removed, please use `auto trait Foo {}`
1618
//~^^ WARN this was previously accepted by the compiler

src/test/run-pass/auto-traits.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(optin_builtin_traits)]
11+
#![feature(optin_builtin_traits, dynsized)]
1212

13-
auto trait Auto {}
13+
use std::marker::DynSized;
14+
15+
auto trait Auto: ?DynSized {}
1416
// Redundant but accepted until we remove it.
1517
#[allow(auto_impl)]
1618
impl Auto for .. {}
1719

18-
unsafe auto trait AutoUnsafe {}
20+
unsafe auto trait AutoUnsafe: ?DynSized {}
1921

2022
impl !Auto for bool {}
2123
impl !AutoUnsafe for bool {}
@@ -34,6 +36,6 @@ fn main() {
3436
take_auto_unsafe(0);
3537
take_auto_unsafe(AutoBool(true));
3638

37-
/// Auto traits are allowed in trait object bounds.
39+
// Auto traits are allowed in trait object bounds.
3840
let _: &(Send + Auto) = &0;
3941
}

src/test/run-pass/extern-types-trait-impl.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@
1010

1111
// Test that traits can be implemented for extern types.
1212

13-
#![feature(extern_types)]
13+
#![feature(extern_types, dynsized)]
14+
15+
use std::marker::DynSized;
1416

1517
extern {
1618
type A;
1719
}
1820

19-
trait Foo {
21+
trait Foo: ?DynSized {
2022
fn foo(&self) { }
2123
}
2224

2325
impl Foo for A {
2426
fn foo(&self) { }
2527
}
2628

27-
fn assert_foo<T: ?Sized + Foo>() { }
29+
fn assert_foo<T: ?DynSized + Foo>() { }
2830

29-
fn use_foo<T: ?Sized + Foo>(x: &Foo) {
31+
fn use_foo<T: ?DynSized + Foo>(x: &Foo) {
3032
x.foo();
3133
}
3234

0 commit comments

Comments
 (0)