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

Don't use unwrap after calling Span.join #25

Closed
wants to merge 1 commit into from

Commits on Jun 11, 2020

  1. Don't use unwrap after calling Span.join

    The method `Span.join` will return `None` if the start and end `Span`s
    are from different files. This is currently difficult to observe in
    practice due to rust-lang/rust#43081, which causes span information
    (including file information) to be lost in many cases.
    
    However, PR rust-lang/rust#73084 will cause `Spans` to be properly
    preserved in many more cases. This will cause `rocket` to to stop
    compiling, as this code will end up getting hit with spans from
    different files (one from rocket, and one from the `result` ident
    defined in the `pear_try!` macro.
    
    To reproduce the issue:
    
    1. Checkout SergioBenitez/Rocket#63a4ae048540a6232c3c7c186e9d027081940382
    2. Install https://github.com/kennytm/rustup-toolchain-install-master if
       you don't already have it
    3. Run `rustup-toolchain-install-master 879b8cb7dc2ad9102994457e73cf78d124926ea5`
       (this corresponds to the latest commit from rust-lang/rust#73084)
    4. From the `Rocket` checkout, run `cargo +879b8cb7dc2ad9102994457e73cf78d124926ea5 build`
    5. Observe the panic from `Pear`
    
    I've based this PR on the commit for `Pear 0.1.2`, since the master
    branch has many breaking changes. I would recommend merging this change
    into a separate branch, and making a new `0.1.3` point release.
    Aaron1011 committed Jun 11, 2020
    Configuration menu
    Copy the full SHA
    e9f2bcf View commit details
    Browse the repository at this point in the history