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

Add enum discriminants (#337) #437

Merged
merged 1 commit into from
Sep 1, 2024
Merged

Commits on Sep 1, 2024

  1. Add enum discriminants (#337)

    * Remove nightly from rustdoc v28 test matrix, since that's now v29. (#332)
    
    * Rust 1.78 is no longer beta. (#334)
    
    * Add enum discriminants
    
    * discriminant clone to lifetime annotation
    
    * complicate test examples
    
    * improved discriminant docs
    
    * hedge bets against placeholder representation
    
    Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
    
    * finally got implicit discriminants working
    
    * remove sync structs
    
    * move to Cow<'a, str> for discriminants
    
    * Various clean-ups, still fighting closure bounds
    
    *sigh*
    
    error[E0521]: borrowed data escapes outside of closure
       --> src/adapter/edges.rs:304:28
        |
    260 |   pub(super) fn resolve_variant_edge<'a, V: AsVertex<Vertex<'a>> + 'a>(
        |                                      -- lifetime `'a` defined here
    ...
    302 |           "discriminant" => resolve_neighbors_with(contexts, move |vertex: &'_ Vertex<'a>| {
        |                                                                    ------  - let's call the lifetime of this reference `'1`
        |                                                                    |
        |                                                                    `vertex` is a reference that is only valid in the closure body
    303 |               let origin = vertex.origin;
    304 |               let enum_var = vertex
        |  ____________________________^
    305 | |                 .as_variant()
        | |                             ^
        | |                             |
        | |_____________________________`vertex` escapes the closure body here
        |                               argument requires that `'1` must outlive `'a`
    
    * Actually clone Cow; same error as before, though...
    
    * Got the sucker.
    
    * Wrap up
    
    * Better dcocs for discriminant
    
    Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
    
    * Finish up docs, improve tests
    
    * Add name back.
    
    ---------
    
    Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
    SuperSonicHub1 and obi1kenobi committed Sep 1, 2024
    Configuration menu
    Copy the full SHA
    ff33794 View commit details
    Browse the repository at this point in the history