rust-lang / rust-lang/rust

Feature request: `io::IsTerminal` should not be sealed

Open
#161,989 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-io C-feature-request T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

This is a bit a companion of #161941 in the sense that I hit on the fact that io::IsTerminal is sealed in the same situation.

I have a RenderTarget: io::Write + io::IsTerminal trait in a tool that does fancy things on the terminal, and it would be great to be able to implement it for custom io::Write instances, but io::IsTerminal is sealed so this is not possible.

An ugly workaround is to have RenderTarget: io::Write + IsTerminalEx instead where IsTerminalEx has a blanket implementation for T: io::IsTerminal. But this is just a workaround for the fact that io::IsTerminal is sealed.

Assuming there are no reasons I don't know to keep io::IsTerminal sealed, unsealing it would make life easier in this situation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the definition and sealing rationale for io::IsTerminal, then compare the custom RenderTarget and IsTerminalEx workaround described here. Done means determining whether the public trait can be unsealed and recording the required API and design decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.