mirror of
https://github.com/isar/rusqlite.git
synced 2025-03-31 19:12:58 +08:00
Partial revert 33b5ea3c4398e6c87725cbdadeb3786b1261f83f
This commit is contained in:
parent
21d0f98f92
commit
7f56e9d877
5
.github/workflows/main.yml
vendored
5
.github/workflows/main.yml
vendored
@ -70,6 +70,11 @@ jobs:
|
|||||||
cargo build --example loadable_extension --features "loadable_extension functions trace"
|
cargo build --example loadable_extension --features "loadable_extension functions trace"
|
||||||
cargo run --example load_extension --features "load_extension bundled functions trace"
|
cargo run --example load_extension --features "load_extension bundled functions trace"
|
||||||
|
|
||||||
|
- name: macros
|
||||||
|
run: |
|
||||||
|
cargo test --package rusqlite-macros
|
||||||
|
cargo test --features 'bundled rusqlite-macros'
|
||||||
|
|
||||||
# TODO: move into own action for better caching
|
# TODO: move into own action for better caching
|
||||||
- name: Static build
|
- name: Static build
|
||||||
# Do we expect this to work / should we test with gnu toolchain?
|
# Do we expect this to work / should we test with gnu toolchain?
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! Private implementation details of `rusqlite`.
|
//! Private implementation details of `rusqlite`.
|
||||||
|
|
||||||
use litrs::StringLit;
|
use litrs::StringLit;
|
||||||
use proc_macro::{Group, Span, TokenStream, TokenTree};
|
use proc_macro::{Delimiter, Group, Literal, Span, TokenStream, TokenTree};
|
||||||
|
|
||||||
use fallible_iterator::FallibleIterator;
|
use fallible_iterator::FallibleIterator;
|
||||||
use sqlite3_parser::ast::{ParameterInfo, ToTokens};
|
use sqlite3_parser::ast::{ParameterInfo, ToTokens};
|
||||||
@ -26,6 +26,10 @@ fn try_bind(input: TokenStream) -> Result<TokenStream> {
|
|||||||
(stmt, literal)
|
(stmt, literal)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let literal = match into_literal(&literal) {
|
||||||
|
Some(it) => it,
|
||||||
|
None => return Err("expected a plain string literal".to_string()),
|
||||||
|
};
|
||||||
let call_site = literal.span();
|
let call_site = literal.span();
|
||||||
let string_lit = match StringLit::try_from(literal) {
|
let string_lit = match StringLit::try_from(literal) {
|
||||||
Ok(string_lit) => string_lit,
|
Ok(string_lit) => string_lit,
|
||||||
@ -68,6 +72,20 @@ fn try_bind(input: TokenStream) -> Result<TokenStream> {
|
|||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn into_literal(ts: &TokenTree) -> Option<Literal> {
|
||||||
|
match ts {
|
||||||
|
TokenTree::Literal(l) => Some(l.clone()),
|
||||||
|
TokenTree::Group(g) => match g.delimiter() {
|
||||||
|
Delimiter::None => match g.stream().into_iter().collect::<Vec<_>>().as_slice() {
|
||||||
|
[TokenTree::Literal(l)] => Some(l.clone()),
|
||||||
|
_ => None,
|
||||||
|
},
|
||||||
|
Delimiter::Parenthesis | Delimiter::Brace | Delimiter::Bracket => None,
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn respan(ts: TokenStream, span: Span) -> TokenStream {
|
fn respan(ts: TokenStream, span: Span) -> TokenStream {
|
||||||
let mut res = TokenStream::new();
|
let mut res = TokenStream::new();
|
||||||
for tt in ts {
|
for tt in ts {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user