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

ices/92470.rs: fixed with errors #1396

Merged
merged 1 commit into from
Aug 23, 2022
Merged

ices/92470.rs: fixed with errors #1396

merged 1 commit into from
Aug 23, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#92470

fn main() {
    encode(&mut EncoderImpl);
}

pub trait Encoder {
    type W;

    fn writer(&self) -> Self::W;
}

fn encode<E: Encoder>(mut encoder: E) {
    encoder.writer();
    encode(&mut encoder);
}

struct EncoderImpl;

impl Encoder for EncoderImpl {
    type W = ();

    fn writer(&self) {}
}

impl<'a, T: Encoder> Encoder for &'a mut T {
    type W = T::W;

    fn writer(&self) -> Self::W {
        panic!()
    }
}
=== stdout ===
=== stderr ===
warning: function cannot return without recursing
  --> /home/runner/work/glacier/glacier/ices/92470.rs:11:1
   |
11 | fn encode<E: Encoder>(mut encoder: E) {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
12 |     encoder.writer();
13 |     encode(&mut encoder);
   |     -------------------- recursive call site
   |
   = note: `#[warn(unconditional_recursion)]` on by default
   = help: a `loop` may express intention better if this is on purpose

error[E0275]: overflow evaluating the requirement `<EncoderImpl as Encoder>::W`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`92470`)

error: aborting due to previous error; 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: function cannot return without recursing
  --> /home/runner/work/glacier/glacier/ices/92470.rs:11:1
   |
11 | fn encode<E: Encoder>(mut encoder: E) {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
12 |     encoder.writer();
13 |     encode(&mut encoder);
   |     -------------------- recursive call site
   |
   = note: `#[warn(unconditional_recursion)]` on by default
   = help: a `loop` may express intention better if this is on purpose

error[E0275]: overflow evaluating the requirement `<EncoderImpl as Encoder>::W`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`92470`)

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0275`.
==============
@JohnTitor JohnTitor merged commit e99390e into master Aug 23, 2022
@JohnTitor JohnTitor deleted the autofix/ices/92470.rs branch August 23, 2022 09:43
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