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

docs(macros): remove sentences banning usage of as _ #1619

Merged
merged 4 commits into from
Feb 16, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,9 @@
/// sqlx::query!("select $1::int4 as id", my_int as MyInt4)
/// ```
///
/// In Rust 1.45 we can eliminate this redundancy by allowing casts using `as _` or type ascription
/// syntax, i.e. `my_int: _` (which is unstable but can be stripped), but this requires modifying
/// the expression which is not possible as the macros are currently implemented. Casts to `_` are
/// forbidden for now as they produce rather nasty type errors.
/// Using `expr as _` or `expr : _` simply signals to the macro to not type-check that bind expression,
/// and then that syntax is stripped from the expression so as to not trigger type errors
abonander marked this conversation as resolved.
Show resolved Hide resolved
/// (or an unstable syntax feature in the case of the latter, which is called type ascription).
///
/// ## Type Overrides: Output Columns
/// Type overrides are also available for output columns, utilizing the SQL standard's support
Expand Down