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

ices/59324.rs: fixed with errors #1020

Merged
merged 1 commit into from
Dec 2, 2021
Merged

ices/59324.rs: fixed with errors #1020

merged 1 commit into from
Dec 2, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 2, 2021

Issue: rust-lang/rust#59324

trait BufMut {}
struct Bytes;
struct BytesMut;

pub trait Future {
    type Item;
}

pub trait Service {
    type Response;
    type Future: Future<Item = Self::Response>;
}

pub trait ThriftService<F>:
    Service<
        Response = FramingEncoded<F>,
        Future = Box<Future<Item = FramingEncodedFinal<F>>>,
    >
where
    F: Framing,
{
    fn get_service(
        &self,
    ) -> &Service<
        Response = Self::Response,
        Future = Self::Future,
    >;
}

pub trait BufMutExt: BufMut {
    type Final;
}

impl BufMutExt for BytesMut {
    type Final = Bytes;
}

pub type FramingEncoded<F> = <F as Framing>::EncBuf;
pub type FramingEncodedFinal<F> = <<F as Framing>::EncBuf as BufMutExt>::Final;

pub trait Framing {
    type EncBuf: BufMut;
}

pub struct SRHeaderTransport;
impl Framing for SRHeaderTransport {
    type EncBuf = BytesMut;
}

pub type BoxService<H> = Box<
    ThriftService<
            SRHeaderTransport,
            Response = Bytes,
            Future = Box<Future<Item = Bytes>>,
        >,
>;

fn with_factory<H>(self, factory: BoxService<H>) {}

fn main() {}
=== stdout ===
=== stderr ===
error: `self` parameter is only allowed in associated functions
  --> /home/runner/work/glacier/glacier/ices/59324.rs:58:20
   |
58 | fn with_factory<H>(self, factory: BoxService<H>) {}
   |                    ^^^^ not semantically valid as function parameter
   |
   = note: associated functions are those in `impl` or `trait` definitions

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:17:22
   |
17 |         Future = Box<Future<Item = FramingEncodedFinal<F>>>,
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn Future<Item = FramingEncodedFinal<F>>`
   |
   = note: `#[warn(bare_trait_objects)]` on by default
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:24:11
   |
24 |       ) -> &Service<
   |  ___________^
25 | |         Response = Self::Response,
26 | |         Future = Self::Future,
27 | |     >;
   | |_____^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
24 ~     ) -> &dyn Service<
25 +         Response = Self::Response,
26 +         Future = Self::Future,
27 ~     >;
   |

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:51:5
   |
51 | /     ThriftService<
52 | |             SRHeaderTransport,
53 | |             Response = Bytes,
54 | |             Future = Box<Future<Item = Bytes>>,
55 | |         >,
   | |_________^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
51 ~     dyn ThriftService<
52 +             SRHeaderTransport,
53 +             Response = Bytes,
54 +             Future = Box<Future<Item = Bytes>>,
55 ~         >,
   |

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:54:26
   |
54 |             Future = Box<Future<Item = Bytes>>,
   |                          ^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn Future<Item = Bytes>`
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>

error[E0277]: the trait bound `<F as Framing>::EncBuf: BufMutExt` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:14:1
   |
14 | / pub trait ThriftService<F>:
15 | |     Service<
16 | |         Response = FramingEncoded<F>,
17 | |         Future = Box<Future<Item = FramingEncodedFinal<F>>>,
...  |
27 | |     >;
28 | | }
   | |_^ the trait `BufMutExt` is not implemented for `<F as Framing>::EncBuf`
   |
help: consider further restricting the associated type
   |
20 |     F: Framing, <F as Framing>::EncBuf: BufMutExt
   |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0277]: the trait bound `<F as Framing>::EncBuf: BufMutExt` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:22:5
   |
22 | /     fn get_service(
23 | |         &self,
24 | |     ) -> &Service<
25 | |         Response = Self::Response,
26 | |         Future = Self::Future,
27 | |     >;
   | |______^ the trait `BufMutExt` is not implemented for `<F as Framing>::EncBuf`
   |
help: consider further restricting the associated type
   |
27 |     > where <F as Framing>::EncBuf: BufMutExt;
   |       +++++++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `<F as Framing>::EncBuf: BufMutExt` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:24:10
   |
24 |       ) -> &Service<
   |  __________^
25 | |         Response = Self::Response,
26 | |         Future = Self::Future,
27 | |     >;
   | |_____^ the trait `BufMutExt` is not implemented for `<F as Framing>::EncBuf`
   |
help: consider further restricting the associated type
   |
27 |     > where <F as Framing>::EncBuf: BufMutExt;
   |       +++++++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `BytesMut: BufMut` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:34:6
   |
34 | impl BufMutExt for BytesMut {
   |      ^^^^^^^^^ the trait `BufMut` is not implemented for `BytesMut`
   |
note: required by a bound in `BufMutExt`
  --> /home/runner/work/glacier/glacier/ices/59324.rs:30:22
   |
30 | pub trait BufMutExt: BufMut {
   |                      ^^^^^^ required by this bound in `BufMutExt`

error: aborting due to 5 previous errors; 4 warnings emitted

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

=== stdout ===
=== stderr ===
error: `self` parameter is only allowed in associated functions
  --> /home/runner/work/glacier/glacier/ices/59324.rs:58:20
   |
58 | fn with_factory<H>(self, factory: BoxService<H>) {}
   |                    ^^^^ not semantically valid as function parameter
   |
   = note: associated functions are those in `impl` or `trait` definitions

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:17:22
   |
17 |         Future = Box<Future<Item = FramingEncodedFinal<F>>>,
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn Future<Item = FramingEncodedFinal<F>>`
   |
   = note: `#[warn(bare_trait_objects)]` on by default
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:24:11
   |
24 |       ) -> &Service<
   |  ___________^
25 | |         Response = Self::Response,
26 | |         Future = Self::Future,
27 | |     >;
   | |_____^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
24 ~     ) -> &dyn Service<
25 +         Response = Self::Response,
26 +         Future = Self::Future,
27 ~     >;
   |

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:51:5
   |
51 | /     ThriftService<
52 | |             SRHeaderTransport,
53 | |             Response = Bytes,
54 | |             Future = Box<Future<Item = Bytes>>,
55 | |         >,
   | |_________^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
51 ~     dyn ThriftService<
52 +             SRHeaderTransport,
53 +             Response = Bytes,
54 +             Future = Box<Future<Item = Bytes>>,
55 ~         >,
   |

warning: trait objects without an explicit `dyn` are deprecated
  --> /home/runner/work/glacier/glacier/ices/59324.rs:54:26
   |
54 |             Future = Box<Future<Item = Bytes>>,
   |                          ^^^^^^^^^^^^^^^^^^^^ help: use `dyn`: `dyn Future<Item = Bytes>`
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>

error[E0277]: the trait bound `<F as Framing>::EncBuf: BufMutExt` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:14:1
   |
14 | / pub trait ThriftService<F>:
15 | |     Service<
16 | |         Response = FramingEncoded<F>,
17 | |         Future = Box<Future<Item = FramingEncodedFinal<F>>>,
...  |
27 | |     >;
28 | | }
   | |_^ the trait `BufMutExt` is not implemented for `<F as Framing>::EncBuf`
   |
help: consider further restricting the associated type
   |
20 |     F: Framing, <F as Framing>::EncBuf: BufMutExt
   |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0277]: the trait bound `<F as Framing>::EncBuf: BufMutExt` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:22:5
   |
22 | /     fn get_service(
23 | |         &self,
24 | |     ) -> &Service<
25 | |         Response = Self::Response,
26 | |         Future = Self::Future,
27 | |     >;
   | |______^ the trait `BufMutExt` is not implemented for `<F as Framing>::EncBuf`
   |
help: consider further restricting the associated type
   |
27 |     > where <F as Framing>::EncBuf: BufMutExt;
   |       +++++++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `<F as Framing>::EncBuf: BufMutExt` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:24:10
   |
24 |       ) -> &Service<
   |  __________^
25 | |         Response = Self::Response,
26 | |         Future = Self::Future,
27 | |     >;
   | |_____^ the trait `BufMutExt` is not implemented for `<F as Framing>::EncBuf`
   |
help: consider further restricting the associated type
   |
27 |     > where <F as Framing>::EncBuf: BufMutExt;
   |       +++++++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `BytesMut: BufMut` is not satisfied
  --> /home/runner/work/glacier/glacier/ices/59324.rs:34:6
   |
34 | impl BufMutExt for BytesMut {
   |      ^^^^^^^^^ the trait `BufMut` is not implemented for `BytesMut`
   |
note: required by a bound in `BufMutExt`
  --> /home/runner/work/glacier/glacier/ices/59324.rs:30:22
   |
30 | pub trait BufMutExt: BufMut {
   |                      ^^^^^^ required by this bound in `BufMutExt`

error: aborting due to 5 previous errors; 4 warnings emitted

For more information about this error, try `rustc --explain E0277`.
==============
@Alexendoo Alexendoo merged commit 6f5c053 into master Dec 2, 2021
@Alexendoo Alexendoo deleted the autofix/ices/59324.rs branch December 2, 2021 14:30
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