Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

ices/44861.rs: fixed with errors #405

Merged
merged 1 commit into from
Jun 22, 2020
Merged

ices/44861.rs: fixed with errors #405

merged 1 commit into from
Jun 22, 2020

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#44861

// https://github.com/rust-lang/rust/issues/44861
// Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=bdd59503a0dc2d33c60a949fc7c57633
// You need to select `build` instead of `run`.

#![crate_type = "lib"]
#![feature(specialization)]
#![feature(unsize, coerce_unsized)]

use std::ops::CoerceUnsized;
use std::marker::Unsize;

pub struct SmartassPtr<A: Smartass+?Sized>(A::Data);

pub trait Smartass {
    type Data;
    type Data2: CoerceUnsized<*const [u8]>;
}

pub trait MaybeObjectSafe {}

impl MaybeObjectSafe for () {}

impl<T> Smartass for T {
    type Data = <Self as Smartass>::Data2;
    default type Data2 = ();
}

impl Smartass for () {
    type Data2 = *const [u8; 1];
}

impl Smartass for MaybeObjectSafe {
    type Data = *const [u8];
    type Data2 = *const [u8; 0];
}

impl<U: Smartass+?Sized, T: Smartass+?Sized> CoerceUnsized<SmartassPtr<T>> for SmartassPtr<U>
    where <U as Smartass>::Data: std::ops::CoerceUnsized<<T as Smartass>::Data>
{}

pub fn conv(s: SmartassPtr<()>) -> SmartassPtr<MaybeObjectSafe> {
    s
}
=== stdout ===
=== stderr ===
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/44861.rs:6:12
  |
6 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information

warning: unused import: `std::marker::Unsize`
  --> /home/runner/work/glacier/glacier/ices/44861.rs:10:5
   |
10 | use std::marker::Unsize;
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/44861.rs:32:19
   |
32 | impl Smartass for MaybeObjectSafe {
   |                   ^^^^^^^^^^^^^^^ help: use `dyn`: `dyn MaybeObjectSafe`
   |
   = note: `#[warn(bare_trait_objects)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/44861.rs:41:48
   |
41 | pub fn conv(s: SmartassPtr<()>) -> SmartassPtr<MaybeObjectSafe> {
   |                                                ^^^^^^^^^^^^^^^ help: use `dyn`: `dyn MaybeObjectSafe`

error[E0277]: the trait bound `(): std::ops::CoerceUnsized<*const [u8]>` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/44861.rs:25:5
   |
16 |     type Data2: CoerceUnsized<*const [u8]>;
   |     --------------------------------------- required by `Smartass::Data2`
...
25 |     default type Data2 = ();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::CoerceUnsized<*const [u8]>` is not implemented for `()`

error: aborting due to previous error; 4 warnings emitted

For more information about this error, try `rustc --explain E0277`.
==============

=== stdout ===
=== stderr ===
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/44861.rs:6:12
  |
6 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #31844 <rust-lang/rust#31844> for more information

warning: unused import: `std::marker::Unsize`
  --> /home/runner/work/glacier/glacier/ices/44861.rs:10:5
   |
10 | use std::marker::Unsize;
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/44861.rs:32:19
   |
32 | impl Smartass for MaybeObjectSafe {
   |                   ^^^^^^^^^^^^^^^ help: use `dyn`: `dyn MaybeObjectSafe`
   |
   = note: `#[warn(bare_trait_objects)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/44861.rs:41:48
   |
41 | pub fn conv(s: SmartassPtr<()>) -> SmartassPtr<MaybeObjectSafe> {
   |                                                ^^^^^^^^^^^^^^^ help: use `dyn`: `dyn MaybeObjectSafe`

error[E0277]: the trait bound `(): std::ops::CoerceUnsized<*const [u8]>` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/44861.rs:25:5
   |
16 |     type Data2: CoerceUnsized<*const [u8]>;
   |     --------------------------------------- required by `Smartass::Data2`
...
25 |     default type Data2 = ();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::CoerceUnsized<*const [u8]>` is not implemented for `()`

error: aborting due to previous error; 4 warnings emitted

For more information about this error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit c64b58e into master Jun 22, 2020
@JohnTitor JohnTitor deleted the autofix/ices/44861.rs branch June 22, 2020 12:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants