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

subscriber: fix Layered layers not downcasting to themselves #549

Merged
merged 1 commit into from
Jan 28, 2020

Commits on Jan 28, 2020

  1. subscriber: fix Layered layers not downcasting to themselves

    Currently, a `Layered` struct's implementations of `Subscriber` and
    `Layer` will successfully downcast to either the the `Layer` type or the
    inner type, but *not* to `Layered<Layer, Inner>`. This means that when a
    `Layer` tries to downcast the wrapped subscriber to a known type, and it
    is a `Layered` (so, any time more than one layer wraps a subscriber and
    a layer other than the first one tries to downcast to the inner type it
    wraps), the downcast will fail incorrectly.
    
    This commit fixes the issue by checking if the downcast target `TypeId`
    equals the `Layered` type's `TypeId`, _before_ trying to downcast to the
    layer itself or to the inner type.
    
    Signed-off-by: Eliza Weisman <[email protected]>
    hawkw committed Jan 28, 2020
    Configuration menu
    Copy the full SHA
    b4c15dc View commit details
    Browse the repository at this point in the history