Skip to content
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

Implement unread_byte for byte_buf #2738

Closed
catamorphism opened this issue Jun 28, 2012 · 7 comments
Closed

Implement unread_byte for byte_buf #2738

catamorphism opened this issue Jun 28, 2012 · 7 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@catamorphism
Copy link
Contributor

In the impl of reader for byte_buf, in core::io, unread_byte currently fails with an "implemented" message.

@eholk
Copy link
Contributor

eholk commented Jun 28, 2012

This should be pretty easy to fix. I think it basically just needs to call vec::unshift on the underlying vector.

@ghost ghost assigned catamorphism Nov 24, 2012
@catamorphism
Copy link
Contributor Author

n.b. byte_buf is now BytesReader.

@catamorphism
Copy link
Contributor Author

I tried to do this, but I got confused. Since BytesReader wraps an immutable vector, I don't see a safe way to implement unread_byte. Do we even need it? I don't see it used anywhere.

@erickt
Copy link
Contributor

erickt commented Nov 24, 2012

I'm fine with removing it. How about we remove it, and make an issue to add a Writer wrapper that adds support for unreading bytes/chars?

@catamorphism
Copy link
Contributor Author

Sounds like a plan!

@erickt
Copy link
Contributor

erickt commented Nov 24, 2012

Here it is: #4031.

@catamorphism catamorphism removed their assignment Jun 16, 2014
RalfJung pushed a commit to RalfJung/rust that referenced this issue Dec 24, 2022
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.debug-assertions := True
configure: rust.overflow-checks := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
Attempting with retry: make prepare
---
    Checking tracing-error v0.2.0
error: lifetime parameter `'tcx` never used
  --> src/tools/miri/src/shims/unix/linux/fd/epoll.rs:39:12
   |
39 |     fn dup<'tcx>(&mut self) -> io::Result<Box<dyn FileDescriptor>> {
   |           -^^^^- help: elide the unused lifetime
   |
   = note: `-D unused-lifetimes` implied by `-D warnings`
error: lifetime parameter `'tcx` never used
  --> src/tools/miri/src/shims/unix/linux/fd/event.rs:24:12
   |
   |
24 |     fn dup<'tcx>(&mut self) -> io::Result<Box<dyn FileDescriptor>> {
   |           -^^^^- help: elide the unused lifetime
error: lifetime parameter `'tcx` never used
  --> src/tools/miri/src/shims/unix/linux/fd/socketpair.rs:18:12
   |
   |
18 |     fn dup<'tcx>(&mut self) -> io::Result<Box<dyn FileDescriptor>> {
   |           -^^^^- help: elide the unused lifetime
    Checking color-spantrace v0.2.0
    Checking addr2line v0.17.0
    Checking color-eyre v0.6.2
    Checking ui_test v0.5.0

Aaron1011 pushed a commit to Aaron1011/rust that referenced this issue Jan 6, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

4 participants