-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
syntax: Tweak parsing bounds on generics paths #13079
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn foo1<T>(_: &A<T>: Send) {} | ||
fn foo2<T>(_: ~A<T>: Send + Freeze) {} | ||
fn foo3<T>(_: ~B<int, uint>: 'static) {} | ||
fn foo4<'a, T>(_: ~C<'a, T>: 'static + Send) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to cover one more case, could you add a test with a mod path? Something like: mymod::D<'a, T>: Share + Send
I like this change. Makes it more consistent and intuitive, IMHO. 👍 |
@flaper87 the best part is how it makes bounded generic trait objects work. ;) |
The previous syntax was `Foo:Bound<trait-parameters>`, but this is a little ambiguous because it was being parsed as `Foo: (Bound<trait-parameters)` rather than `Foo: (Bound) <trait-parameters>` This commit changes the syntax to `Foo<trait-parameters>: Bound` in order to be clear where the trait parameters are going. Closes rust-lang#9265
bors
added a commit
that referenced
this pull request
Mar 27, 2014
The previous syntax was `Foo:Bound<trait-parameters>`, but this is a little ambiguous because it was being parsed as `Foo: (Bound<trait-parameters)` rather than `Foo: (Bound) <trait-parameters>` This commit changes the syntax to `Foo<trait-parameters>: Bound` in order to be clear where the trait parameters are going. Closes #9265
matthiaskrgr
pushed a commit
to matthiaskrgr/rust
that referenced
this pull request
Sep 13, 2022
Remove type alias definition on inline Fix rust-lang#13079
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Jul 11, 2024
…idance, r=y21 Fix guidance of [`float_cmp`] and [`float_cmp_const`] to not incorrectly recommend `f__::EPSILON` as the error margin. Using `f32::EPSILON` or `f64::EPSILON` as the floating-point equality comparison error margin is incorrect, yet `float_cmp` has until now recommended this be done. This change fixes the given guidance (both in docs and compiler hints) to not reference these unsuitable constants. Instead, the guidance now clarifies that the scenarios in which an absolute error margin is usable, provides a sample implementation for using a user-defined absolute error margin (as an absolute error margin can only be used-defined and may be different for different comparisons) and references the floating point guide for a reference implementation of relative error based equality comparison for cases where absolute error margins cannot be identified. changelog: [`float_cmp`] Fix guidance to not incorrectly recommend `f__::EPSILON` as the error margin. changelog: [`float_cmp_const`] Fix guidance to not incorrectly recommend `f__::EPSILON` as the error margin. Fixes rust-lang#6816
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous syntax was
Foo:Bound<trait-parameters>
, but this is a littleambiguous because it was being parsed as
Foo: (Bound<trait-parameters)
ratherthan
Foo: (Bound) <trait-parameters>
This commit changes the syntax to
Foo<trait-parameters>: Bound
in order to beclear where the trait parameters are going.
Closes #9265