You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are multiple cases, where the ambiguity of + is not detected. Note, that the analysis is inside libsyntax (e.g. rustfmt throws the ambiguous + error in all cases). This leads to code being able to pass the syntax check, and yielding incorrect results.
List of cases, where additional bounds via + are invalid (only the ones I could find / did know):
shared & mutable reference types
const and mutable raw pointer types
Closure return type position (these are handled wrong in libsyntax according to language spec)
bare function return type position (I think libsyntax got that one right)
This should be solved by properly implementing TypeNoBounds as a sub parser for all type expressions.
TypeNoBounds can then be invoked in all of these 5 cases. Note, that the allow_bound mechanism in the path_() parser should probably be replaced by something else. E.g. by using TypeParamBounds in all the correct places and implementing it correctly.
The text was updated successfully, but these errors were encountered:
ruabmbua
changed the title
Ambiguous + detection for Trait and lifetime bounds is broken
Bug: ambiguous + detection for Trait and lifetime bounds is broken
Dec 17, 2018
@ruabmbua I think the best way to fix this might be not in the parser itself, but in the validation layer. That is, after the parsig is done, you traverse the tree and check that all disambiguating parenthesis are present.
Example: playground
Related: issue #279
There are multiple cases, where the ambiguity of
+
is not detected. Note, that the analysis is inside libsyntax (e.g. rustfmt throws the ambiguous+
error in all cases). This leads to code being able to pass the syntax check, and yielding incorrect results.List of cases, where additional bounds via
+
are invalid (only the ones I could find / did know):This should be solved by properly implementing TypeNoBounds as a sub parser for all type expressions.
TypeNoBounds can then be invoked in all of these 5 cases. Note, that the allow_bound mechanism in the path_() parser should probably be replaced by something else. E.g. by using TypeParamBounds in all the correct places and implementing it correctly.
The text was updated successfully, but these errors were encountered: