Auto merge of #136764 - traviscross:TC/make-ptr_cast_add_auto_to_obje… · rust-lang/rust@8cf44c8 (original) (raw)

1

``

`` -

warning: adding an auto trait Send to a trait object in a pointer cast may cause UB later on

``

2

``

`-

--> $DIR/ptr-to-trait-obj-add-auto.rs:6:5

`

``

1

`` +

error[E0802]: cannot add auto trait Send to dyn bound via pointer cast

``

``

2

`+

--> $DIR/ptr-to-trait-obj-add-auto.rs:4:5

`

3

3

` |

`

4

4

`LL | x as _

`

5

``

`-

| ^^^^^^

`

``

5

`+

| ^^^^^^ unsupported cast

`

6

6

` |

`

7

``

`-

= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

`

8

``

`-

= note: for more information, see issue #127323 https://github.com/rust-lang/rust/issues/127323

`

9

``

`` -

= note: #[warn(ptr_cast_add_auto_to_object)] on by default

``

``

7

`+

= note: this could allow UB elsewhere

`

``

8

`` +

= help: use transmute if you're sure this is sound

``

10

9

``

11

``

`` -

warning: adding auto traits Send, Sync, and Unpin to a trait object in a pointer cast may cause UB later on

``

``

10

`` +

error[E0802]: cannot add auto traits Send, Sync, and Unpin to dyn bound via pointer cast

``

12

11

` --> $DIR/ptr-to-trait-obj-add-auto.rs:13:5

`

13

12

` |

`

14

13

`LL | x as _

`

15

``

`-

| ^^^^^^

`

``

14

`+

| ^^^^^^ unsupported cast

`

16

15

` |

`

17

``

`-

= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

`

18

``

`-

= note: for more information, see issue #127323 https://github.com/rust-lang/rust/issues/127323

`

``

16

`+

= note: this could allow UB elsewhere

`

``

17

`` +

= help: use transmute if you're sure this is sound

``

19

18

``

20

``

`-

warning: 2 warnings emitted

`

21

``

-

22

``

`-

Future incompatibility report: Future breakage diagnostic:

`

23

``

`` -

warning: adding an auto trait Send to a trait object in a pointer cast may cause UB later on

``

24

``

`-

--> $DIR/ptr-to-trait-obj-add-auto.rs:6:5

`

25

``

`-

|

`

26

``

`-

LL | x as _

`

27

``

`-

| ^^^^^^

`

28

``

`-

|

`

29

``

`-

= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

`

30

``

`-

= note: for more information, see issue #127323 https://github.com/rust-lang/rust/issues/127323

`

31

``

`` -

= note: #[warn(ptr_cast_add_auto_to_object)] on by default

``

32

``

-

33

``

`-

Future breakage diagnostic:

`

34

``

`` -

warning: adding auto traits Send, Sync, and Unpin to a trait object in a pointer cast may cause UB later on

``

35

``

`-

--> $DIR/ptr-to-trait-obj-add-auto.rs:13:5

`

36

``

`-

|

`

37

``

`-

LL | x as _

`

38

``

`-

| ^^^^^^

`

39

``

`-

|

`

40

``

`-

= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

`

41

``

`-

= note: for more information, see issue #127323 https://github.com/rust-lang/rust/issues/127323

`

42

``

`` -

= note: #[warn(ptr_cast_add_auto_to_object)] on by default

``

``

19

`+

error: aborting due to 2 previous errors

`

43

20

``

``

21

`` +

For more information about this error, try rustc --explain E0802.

``