Skip to content

Re-implement PortReader in terms of a generic BytesIterReader #10887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

rapha
Copy link
Contributor

@rapha rapha commented Dec 10, 2013

Inspired by

#10823 (comment)

/// let chunks = ~[~[1u8, 2u8], ~[3u8], ~[4u8, 5u8]].move_iter().filter(|vals| vals.len() > 1);
///
/// let mut buf = ~[0u8, ..3];
/// match reader.read(chunks) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forget to define reader?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixed.

@alexcrichton
Copy link
Member

I personally think that this is taking generics a bit too far. We already have MemReader and BufReader along with soon having a MultiReader, so I'm in favor of leaving things as-is today.

@pcwalton
Copy link
Contributor

agreed with @alexcrichton, closing.

@pcwalton pcwalton closed this Dec 10, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2023
[`missing_fields_in_debug`]: don't ICE when self type is a generic param

Fixes rust-lang#10887

This PR fixes an ICE that happens when the implementor (self type) of a `Debug` impl is a generic parameter.
The lint calls `TyCtxt::type_of` with that self type, which ICEs when called with generic parameters, so this just adds a quick check before getting there to ignore them.

That can only happen inside of core itself (afaik) because the orphan rules forbid defining an impl such as `impl<T> Debug for T` outside of core, so I'm not sure how to add a test for this.
It seems like this impl in particular caused this: https://doc.rust-lang.org/stable/std/fmt/trait.Debug.html#impl-Debug-for-F

changelog: [`missing_fields_in_debug`]: don't ICE on blanket `Debug` impl in core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants