Skip to content

Commit

Permalink
front: improve tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Sep 14, 2024
1 parent fbd9486 commit 584c13a
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 130 deletions.
16 changes: 8 additions & 8 deletions src/option_bundles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,43 +111,43 @@ impl RuleOptions {
BundleDoc {
name: "nadri",
options: Self::NADRI,
doc: "a reasonable proposal; like `stateless` but \
doc: "A reasonable proposal; like `stateless` but \
forbids `ref` bindings that create temporaries",
},
BundleDoc {
name: "stateless",
options: Self::STATELESS,
doc: "a proposal that tracks no hidden state; purely type-based",
doc: "A proposal that tracks no hidden state; purely type-based",
},
BundleDoc {
name: "stable_rust",
options: Self::STABLE_RUST,
doc: "emulates the behavior of current stable rust",
doc: "The behavior of current stable rust",
},
BundleDoc {
name: "rfc3627",
options: Self::ERGO2024,
doc: "the accepted RFC3627 behavior",
doc: "The accepted RFC3627 behavior",
},
BundleDoc {
name: "rfc3627_2021",
options: Self::RFC3627_2021,
doc: "the accepted RFC3627 behavior under edition 2021",
doc: "The accepted RFC3627 behavior under edition 2021",
},
BundleDoc {
name: "rfc3627_breaking_only",
options: Self::ERGO2024_BREAKING_ONLY,
doc: "the breaking changes for edition 2024 planned in RFC3627",
doc: "The breaking changes for edition 2024 planned in RFC3627",
},
BundleDoc {
name: "structural",
options: Self::STRUCTURAL,
doc: "purely structural matching, with no match ergonomics",
doc: "Purely structural matching, with no match ergonomics",
},
BundleDoc {
name: "waffle",
options: Self::WAFFLE,
doc: "a proposal by @WaffleLapkin (excluding the proposed rule3 extension)",
doc: "A proposal by @WaffleLapkin (excluding the proposed rule3 extension)",
},
// ("rpjohnst", Self::RPJOHNST, "(TODO) a proposal by @rpjohnst"),
];
Expand Down
20 changes: 10 additions & 10 deletions src/typing_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,36 +94,36 @@ impl RuleOptions {
OptionsDoc {
name: "match_constructor_through_ref",
values: &["false", "true"],
doc: "whether `[p]` can match on `&[T]`; the heart of match ergonomics.",
doc: "Whether `[p]` can match on `&[T]`; the heart of match ergonomics.",
},
OptionsDoc {
name: "eat_inherited_ref_alone",
values: &["false", "true"],
doc: "whether `&p`/`&mut p` is allowed on an inherited reference \
doc: "Whether `&p`/`&mut p` is allowed on an inherited reference \
if the underlying type isn't also a reference type",
},
OptionsDoc {
name: "inherited_ref_on_ref",
values: &["EatOuter", "EatInner", "EatBoth"],
doc: "how to handle a reference pattern on a \
doc: "How to handle a reference pattern on a \
double reference when the outer one is inherited",
},
OptionsDoc {
name: "fallback_to_outer",
values: &["false", "true"],
doc: "whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` \
doc: "Whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` \
case has a mutability mismatch",
},
OptionsDoc {
name: "eat_mut_inside_shared",
values: &["false", "true"],
doc: "in `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` \
doc: "In `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` \
from under a `&`",
},
OptionsDoc {
name: "allow_ref_pat_on_ref_mut",
values: &["false", "true"],
doc: "whether to allow `&p: &mut T`",
doc: "Whether to allow a shared ref pattern on a mutable ref type",
},
OptionsDoc {
name: "downgrade_mut_inside_shared",
Expand All @@ -134,22 +134,22 @@ impl RuleOptions {
OptionsDoc {
name: "ref_binding_on_inherited",
values: &["Error", "ResetBindingMode", "AllocTemporary"],
doc: "how to handle a `ref x` binding on an inherited reference",
doc: "How to handle a `ref x` binding on an inherited reference",
},
OptionsDoc {
name: "mut_binding_on_inherited",
values: &["Error", "ResetBindingMode", "Keep"],
doc: "how to handle a `mut x` binding on an inherited reference",
doc: "How to handle a `mut x` binding on an inherited reference",
},
OptionsDoc {
name: "simplify_deref_mut",
values: &["false", "true"],
doc: "whether to simplify `*&mut expr`, which removes some borrow errors",
doc: "Whether to simplify `*&mut expr`, which removes some borrow errors",
},
OptionsDoc {
name: "always_inspect_bm",
values: &["false", "true"],
doc: "whether to always branch on the binding mode when computing rules. \
doc: "Whether to always branch on the binding mode when computing rules. \
this is required for the `SequentBindingMode` style",
},
];
Expand Down
36 changes: 18 additions & 18 deletions tests/snapshots/trace_cli@11515459865669657874.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ Error: unknown value `true` for option `ref_binding_on_inherited`; options are:

Options are:
- match_constructor_through_ref: false | true
whether `[p]` can match on `&[T]`; the heart of match ergonomics.
Whether `[p]` can match on `&[T]`; the heart of match ergonomics.
- eat_inherited_ref_alone: false | true
whether `&p`/`&mut p` is allowed on an inherited reference if the underlying type isn't also a reference type
Whether `&p`/`&mut p` is allowed on an inherited reference if the underlying type isn't also a reference type
- inherited_ref_on_ref: EatOuter | EatInner | EatBoth
how to handle a reference pattern on a double reference when the outer one is inherited
How to handle a reference pattern on a double reference when the outer one is inherited
- fallback_to_outer: false | true
whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` case has a mutability mismatch
Whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` case has a mutability mismatch
- eat_mut_inside_shared: false | true
in `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` from under a `&`
In `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` from under a `&`
- allow_ref_pat_on_ref_mut: false | true
whether to allow `&p: &mut T`
Whether to allow a shared ref pattern on a mutable ref type
- downgrade_mut_inside_shared: false | true
RFC3627 rule 3: downgrade `&mut` inherited references to `&` inside a shared deref
- ref_binding_on_inherited: Error | ResetBindingMode | AllocTemporary
how to handle a `ref x` binding on an inherited reference
How to handle a `ref x` binding on an inherited reference
- mut_binding_on_inherited: Error | ResetBindingMode | Keep
how to handle a `mut x` binding on an inherited reference
How to handle a `mut x` binding on an inherited reference
- simplify_deref_mut: false | true
whether to simplify `*&mut expr`, which removes some borrow errors
Whether to simplify `*&mut expr`, which removes some borrow errors
- always_inspect_bm: false | true
whether to always branch on the binding mode when computing rules. this is required for the `SequentBindingMode` style
Whether to always branch on the binding mode when computing rules. this is required for the `SequentBindingMode` style
- predicate_style: Expression | Sequent | BindingMode | SequentBindingMode | Stateless
the style of the typing predicate; not all rulesets can be expressed in all styles, only `Expression` is compatible with all rulesets

There also exist some predefined option-bundles. Activate one with `set <bundle>`
- nadri: a reasonable proposal; like `stateless` but forbids `ref` bindings that create temporaries
- stateless: a proposal that tracks no hidden state; purely type-based
- stable_rust: emulates the behavior of current stable rust
- rfc3627: the accepted RFC3627 behavior
- rfc3627_2021: the accepted RFC3627 behavior under edition 2021
- rfc3627_breaking_only: the breaking changes for edition 2024 planned in RFC3627
- structural: purely structural matching, with no match ergonomics
- waffle: a proposal by @WaffleLapkin (excluding the proposed rule3 extension)
- nadri: A reasonable proposal; like `stateless` but forbids `ref` bindings that create temporaries
- stateless: A proposal that tracks no hidden state; purely type-based
- stable_rust: The behavior of current stable rust
- rfc3627: The accepted RFC3627 behavior
- rfc3627_2021: The accepted RFC3627 behavior under edition 2021
- rfc3627_breaking_only: The breaking changes for edition 2024 planned in RFC3627
- structural: Purely structural matching, with no match ergonomics
- waffle: A proposal by @WaffleLapkin (excluding the proposed rule3 extension)
36 changes: 18 additions & 18 deletions tests/snapshots/trace_cli@16736406663811832092.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ Error: unknown option `mistyped`

Options are:
- match_constructor_through_ref: false | true
whether `[p]` can match on `&[T]`; the heart of match ergonomics.
Whether `[p]` can match on `&[T]`; the heart of match ergonomics.
- eat_inherited_ref_alone: false | true
whether `&p`/`&mut p` is allowed on an inherited reference if the underlying type isn't also a reference type
Whether `&p`/`&mut p` is allowed on an inherited reference if the underlying type isn't also a reference type
- inherited_ref_on_ref: EatOuter | EatInner | EatBoth
how to handle a reference pattern on a double reference when the outer one is inherited
How to handle a reference pattern on a double reference when the outer one is inherited
- fallback_to_outer: false | true
whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` case has a mutability mismatch
Whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` case has a mutability mismatch
- eat_mut_inside_shared: false | true
in `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` from under a `&`
In `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` from under a `&`
- allow_ref_pat_on_ref_mut: false | true
whether to allow `&p: &mut T`
Whether to allow a shared ref pattern on a mutable ref type
- downgrade_mut_inside_shared: false | true
RFC3627 rule 3: downgrade `&mut` inherited references to `&` inside a shared deref
- ref_binding_on_inherited: Error | ResetBindingMode | AllocTemporary
how to handle a `ref x` binding on an inherited reference
How to handle a `ref x` binding on an inherited reference
- mut_binding_on_inherited: Error | ResetBindingMode | Keep
how to handle a `mut x` binding on an inherited reference
How to handle a `mut x` binding on an inherited reference
- simplify_deref_mut: false | true
whether to simplify `*&mut expr`, which removes some borrow errors
Whether to simplify `*&mut expr`, which removes some borrow errors
- always_inspect_bm: false | true
whether to always branch on the binding mode when computing rules. this is required for the `SequentBindingMode` style
Whether to always branch on the binding mode when computing rules. this is required for the `SequentBindingMode` style
- predicate_style: Expression | Sequent | BindingMode | SequentBindingMode | Stateless
the style of the typing predicate; not all rulesets can be expressed in all styles, only `Expression` is compatible with all rulesets

There also exist some predefined option-bundles. Activate one with `set <bundle>`
- nadri: a reasonable proposal; like `stateless` but forbids `ref` bindings that create temporaries
- stateless: a proposal that tracks no hidden state; purely type-based
- stable_rust: emulates the behavior of current stable rust
- rfc3627: the accepted RFC3627 behavior
- rfc3627_2021: the accepted RFC3627 behavior under edition 2021
- rfc3627_breaking_only: the breaking changes for edition 2024 planned in RFC3627
- structural: purely structural matching, with no match ergonomics
- waffle: a proposal by @WaffleLapkin (excluding the proposed rule3 extension)
- nadri: A reasonable proposal; like `stateless` but forbids `ref` bindings that create temporaries
- stateless: A proposal that tracks no hidden state; purely type-based
- stable_rust: The behavior of current stable rust
- rfc3627: The accepted RFC3627 behavior
- rfc3627_2021: The accepted RFC3627 behavior under edition 2021
- rfc3627_breaking_only: The breaking changes for edition 2024 planned in RFC3627
- structural: Purely structural matching, with no match ergonomics
- waffle: A proposal by @WaffleLapkin (excluding the proposed rule3 extension)
36 changes: 18 additions & 18 deletions tests/snapshots/trace_cli@17515479014605656910.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ Error: Syntax is `set option value`.

Options are:
- match_constructor_through_ref: false | true
whether `[p]` can match on `&[T]`; the heart of match ergonomics.
Whether `[p]` can match on `&[T]`; the heart of match ergonomics.
- eat_inherited_ref_alone: false | true
whether `&p`/`&mut p` is allowed on an inherited reference if the underlying type isn't also a reference type
Whether `&p`/`&mut p` is allowed on an inherited reference if the underlying type isn't also a reference type
- inherited_ref_on_ref: EatOuter | EatInner | EatBoth
how to handle a reference pattern on a double reference when the outer one is inherited
How to handle a reference pattern on a double reference when the outer one is inherited
- fallback_to_outer: false | true
whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` case has a mutability mismatch
Whether to try again in `EatOuter` mode when a `EatBoth` or `EatInner` case has a mutability mismatch
- eat_mut_inside_shared: false | true
in `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` from under a `&`
In `EatInner` or `EatBoth`, `&mut p` can eat an inner `&mut T` from under a `&`
- allow_ref_pat_on_ref_mut: false | true
whether to allow `&p: &mut T`
Whether to allow a shared ref pattern on a mutable ref type
- downgrade_mut_inside_shared: false | true
RFC3627 rule 3: downgrade `&mut` inherited references to `&` inside a shared deref
- ref_binding_on_inherited: Error | ResetBindingMode | AllocTemporary
how to handle a `ref x` binding on an inherited reference
How to handle a `ref x` binding on an inherited reference
- mut_binding_on_inherited: Error | ResetBindingMode | Keep
how to handle a `mut x` binding on an inherited reference
How to handle a `mut x` binding on an inherited reference
- simplify_deref_mut: false | true
whether to simplify `*&mut expr`, which removes some borrow errors
Whether to simplify `*&mut expr`, which removes some borrow errors
- always_inspect_bm: false | true
whether to always branch on the binding mode when computing rules. this is required for the `SequentBindingMode` style
Whether to always branch on the binding mode when computing rules. this is required for the `SequentBindingMode` style
- predicate_style: Expression | Sequent | BindingMode | SequentBindingMode | Stateless
the style of the typing predicate; not all rulesets can be expressed in all styles, only `Expression` is compatible with all rulesets

There also exist some predefined option-bundles. Activate one with `set <bundle>`
- nadri: a reasonable proposal; like `stateless` but forbids `ref` bindings that create temporaries
- stateless: a proposal that tracks no hidden state; purely type-based
- stable_rust: emulates the behavior of current stable rust
- rfc3627: the accepted RFC3627 behavior
- rfc3627_2021: the accepted RFC3627 behavior under edition 2021
- rfc3627_breaking_only: the breaking changes for edition 2024 planned in RFC3627
- structural: purely structural matching, with no match ergonomics
- waffle: a proposal by @WaffleLapkin (excluding the proposed rule3 extension)
- nadri: A reasonable proposal; like `stateless` but forbids `ref` bindings that create temporaries
- stateless: A proposal that tracks no hidden state; purely type-based
- stable_rust: The behavior of current stable rust
- rfc3627: The accepted RFC3627 behavior
- rfc3627_2021: The accepted RFC3627 behavior under edition 2021
- rfc3627_breaking_only: The breaking changes for edition 2024 planned in RFC3627
- structural: Purely structural matching, with no match ergonomics
- waffle: A proposal by @WaffleLapkin (excluding the proposed rule3 extension)
Loading

0 comments on commit 584c13a

Please sign in to comment.