Closed Fishrock123 closed 3 years ago
Why wouldn't the user just test if the option is None?
Ohhh… I see what's going on. What if we just used some already available type like Option<String>
(which also implements Display)
I don't understand? Option<Option<?>>
? Option
only implements Display
if T
also does.
The idea here is to have the same traits as Backtrace
so the type system doesn't complain on stable.
@Fishrock123 sorry, forgot that comments don't auto escape <
— typed Option<String>
. the String part is what would change. Pretty much any built-in-type that's Display+Debug, because writing code that will never be executed seems a little weird. At the very least, we could unreachable!()
it to make clear it shouldn't ever get called
I would rather it be a type that implements exactly the same traits as Backtrace
, personally.
Ultimately, the correct answer here is that it would be Option<!>
, using the experimental never type to denote that it will only ever be None
. (And also because never
is able to auto-implement all basic traits. Or something.)
Yep, agreed that !
would be ideal if stable
This prevents the need for users to do backtrace feature-checking for code that wishes to use
Display
for a backtrace and also compile on stable.