Option as_ref compilation error when implementing cause method for Error trait #53716
Labels
A-trait-system
Area: Trait system
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Hi, I'm new to rust and this looks like a possible bug to me. I implemented my own error type (focus on the cause method implementation in Error trait):
This code seems to work correctly but when I use the commented
self.cause.as_ref()
instead of the match clause I'm getting following compilation error:I would normally expect it to work because the working match I use as workaround is pretty much the same as the underlying implementation of as_ref() in Option.
Meta
λ rustc --version --verbose
rustc 1.28.0 (9634041 2018-07-30)
binary: rustc
commit-hash: 9634041
commit-date: 2018-07-30
host: x86_64-pc-windows-msvc
release: 1.28.0
LLVM version: 6.0
The text was updated successfully, but these errors were encountered: