postgres-parser icon indicating copy to clipboard operation
postgres-parser copied to clipboard

segmentation fault with example project from README

Open alex-dukhno opened this issue 5 years ago β€’ 34 comments

Hi thank you for this crate, I am considering to use it in my db project instead of sqlparser

However, when I tried to run simple project from README example:

use postgres_parser::*;

fn main() {
    let args: Vec<String> = std::env::args().collect();
    let query_string = args.get(1).expect("no arguments");
    let parse_list = match parse_query(query_string) {
        Ok(query) => query,
        Err(e) => {
            eprintln!("{:?}", e);
            std::process::exit(1);
        }
    };

    let as_json = serde_json::to_string_pretty(&parse_list).expect("failed to convert to json");
    println!("{}", as_json);
}

I got segmentation fault:

alex-dukhno@Alexs-MacBook Projects/test-pro (master %) Β» cargo run ../isomorphicdb/docs/user-guide/sql/basic_queries.sql
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/test-pro ../isomorphicdb/docs/user-guide/sql/basic_queries.sql`
[1]    45017 segmentation fault  cargo run ../isomorphicdb/docs/user-guide/sql/basic_queries.sql

however, when I run one example (e.g. scanner) it works πŸ€·β€β™‚οΈ :

alex-dukhno@Alexs-MacBook Projects/postgres-parser (fix-workflow-for-mac-os) Β» cargo run --example scanner ../isomorphicdb/docs/user-guide/sql/basic_queries.sql
   Compiling postgres-parser v0.2.2 (/Users/alex-dukhno/Projects/postgres-parser)
    Finished dev [unoptimized + debuginfo] target(s) in 15.26s
     Running `target/debug/examples/scanner ../isomorphicdb/docs/user-guide/sql/basic_queries.sql`
#1
-- Copyright 2020 - present Alex Dukhno
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--     http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

create schema SMOKE_QUERIES;
-- {"CreateSchemaStmt":{"schemaname":"smoke_queries","if_not_exists":false}}
....

any advice on how to troubleshoot this appreciated πŸ˜„

alex-dukhno avatar Feb 20 '21 17:02 alex-dukhno

That's interesting. Can you post the contents of "basic_queries.sql"?

Also, can you run it via gdb/lldb to get a backtrace?

eeeebbbbrrrr avatar Feb 20 '21 18:02 eeeebbbbrrrr

Can you post the contents of "basic_queries.sql"?

content of the file could be found here https://github.com/alex-dukhno/isomorphicdb/blob/main/docs/user-guide/sql/basic_queries.sql

Also, can you run it via gdb/lldb to get a backtrace?

let me set it up and try to run it

alex-dukhno avatar Feb 20 '21 19:02 alex-dukhno

also, I suppose it's worth pointing out that that example is meant to be run as: cargo run "SQL STATEMENT HERE", not taking a path to a file.

That said, you should have just gotten a parse error, not a core dump

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

I configured https://github.com/japaric/rust-san#how-to-use-the-sanitizers This is what I got when run project

alex-dukhno@Alexs-MacBook Projects/test-pro (master %) Β» RUSTFLAGS="-Z sanitizer=$SAN" cargo run --target x86_64-apple-darwin ../isomorphicdb/docs/user-guide/sql/basic_queries.sql
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/x86_64-apple-darwin/debug/test-pro ../isomorphicdb/docs/user-guide/sql/basic_queries.sql`
AddressSanitizer:DEADLYSIGNAL
=================================================================
==59457==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x7fff2044b3ee bp 0x7ffeea67cbd0 sp 0x7ffeea67cba8 T0)
==59457==The signal is caused by a READ memory access.
==59457==Hint: this fault was caused by a dereference of a high value address (see register values below).  Dissassemble the provided pc to learn which register was used.
    #0 0x7fff2044b3ee in stack_not_16_byte_aligned_error+0x0 (libdyld.dylib:x86_64+0x143ee)
    #1 0x105aa9dab in raw_parser+0x3b (test-pro:x86_64+0x100529dab)
    #2 0x105a2a533 in postgres_parser::parser::parse_query::raw_parser_wrapper::h3445a9b124aa3ee1 parser.rs:119
    #3 0x105a28593 in postgres_parser::parser::parse_query::hdfbbb62e7b860e17 parser.rs:190
    #4 0x105708594 in test_pro::main::h67fdad59256500e9 main.rs:6
    #5 0x10570b29d in core::ops::function::FnOnce::call_once::he87eed73c0cb45c5 function.rs:227
    #6 0x10558d76e in std::sys_common::backtrace::__rust_begin_short_backtrace::hddb5b10bbc852178 backtrace.rs:125
    #7 0x1057147cf in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hf018630f157b2693 rt.rs:66
    #8 0x105b15923 in std::rt::lang_start_internal::h6cd9161d564e26bc rt.rs:51
    #9 0x10571472b in std::rt::lang_start::hc1b36c2fbbf96bb5 rt.rs:65
    #10 0x105708f31 in main+0x21 (test-pro:x86_64+0x100188f31)
    #11 0x7fff2044c620 in start+0x0 (libdyld.dylib:x86_64+0x15620)

==59457==Register values:
rax = 0x0000000000005e38  rbx = 0x00007ffeea67cee0  rcx = 0x00007ffeea67cbe8  rdx = 0x0000000000000000
rdi = 0x0000625000005218  rsi = 0x0000000000000400  rbp = 0x00007ffeea67cbd0  rsp = 0x00007ffeea67cba8
 r8 = 0x0000000000000020   r9 = 0x0000000000000001  r10 = 0x00000001107ee450  r11 = 0x0000000105c804b0
r12 = 0x00007ffeea67d480  r13 = 0x00007ffeea67d4a0  r14 = 0xf3f3f3f8f8f8f8f8  r15 = 0xf2f2f2f8f8f8f2f2
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libdyld.dylib:x86_64+0x143ee) in stack_not_16_byte_aligned_error+0x0
==59457==ABORTING
[1]    59457 abort      RUSTFLAGS="-Z sanitizer=$SAN" cargo run --target x86_64-apple-darwin

alex-dukhno avatar Feb 20 '21 19:02 alex-dukhno

That’s helpful. Thanks. It crashed in Postgres’ code which means I’ve got a bug somewhere on the rust side (likely). I’ll investigate.

But like I said above, you’re using that example wrong. :)

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

But like I said above, you’re using that example wrong. :)

Give me a minute πŸ˜„ This is with cargo run "SQL STATEMENT HERE" example

alex-dukhno@Alexs-MacBook Projects/test-pro (master %) Β» RUSTFLAGS="-Z sanitizer=$SAN" cargo run --target x86_64-apple-darwin "create schema schema_name"
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/x86_64-apple-darwin/debug/test-pro 'create schema schema_name'`
'"create schema schema_name"'
AddressSanitizer:DEADLYSIGNAL
=================================================================
==59737==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x7fff2044b3ee bp 0x7ffee9174af0 sp 0x7ffee9174ac8 T0)
==59737==The signal is caused by a READ memory access.
==59737==Hint: this fault was caused by a dereference of a high value address (see register values below).  Dissassemble the provided pc to learn which register was used.
    #0 0x7fff2044b3ee in stack_not_16_byte_aligned_error+0x0 (libdyld.dylib:x86_64+0x143ee)
    #1 0x106fb1d5b in raw_parser+0x3b (test-pro:x86_64+0x100529d5b)
    #2 0x106f324e3 in postgres_parser::parser::parse_query::raw_parser_wrapper::h3445a9b124aa3ee1 parser.rs:119
    #3 0x106f30543 in postgres_parser::parser::parse_query::hdfbbb62e7b860e17 parser.rs:190
    #4 0x106c10568 in test_pro::main::h67fdad59256500e9 main.rs:7
    #5 0x106c1324d in core::ops::function::FnOnce::call_once::he87eed73c0cb45c5 function.rs:227
    #6 0x106a954be in std::sys_common::backtrace::__rust_begin_short_backtrace::hddb5b10bbc852178 backtrace.rs:125
    #7 0x106c1c77f in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hf018630f157b2693 rt.rs:66
    #8 0x10701d8d3 in std::rt::lang_start_internal::h6cd9161d564e26bc rt.rs:51
    #9 0x106c1c6db in std::rt::lang_start::hc1b36c2fbbf96bb5 rt.rs:65
    #10 0x106c10ee1 in main+0x21 (test-pro:x86_64+0x100188ee1)
    #11 0x7fff2044c620 in start+0x0 (libdyld.dylib:x86_64+0x15620)

==59737==Register values:
rax = 0x0000000000005e38  rbx = 0x00007ffee9174e00  rcx = 0x00007ffee9174b08  rdx = 0x0000000000000000
rdi = 0x0000625000005218  rsi = 0x0000000000000400  rbp = 0x00007ffee9174af0  rsp = 0x00007ffee9174ac8
 r8 = 0x0000000000000007   r9 = 0xffffe3b5fffff5c4  r10 = 0x000000010baeb450  r11 = 0x00000001071884b0
r12 = 0x00007ffee91753a0  r13 = 0x00007ffee91753c0  r14 = 0xf3f3f3f8f8f8f8f8  r15 = 0xf2f2f2f8f8f8f2f2
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libdyld.dylib:x86_64+0x143ee) in stack_not_16_byte_aligned_error+0x0
==59737==ABORTING
[1]    59737 abort      RUSTFLAGS="-Z sanitizer=$SAN" cargo run --target x86_64-apple-darwin

alex-dukhno avatar Feb 20 '21 19:02 alex-dukhno

What kind of MacBook do you have? Is it a new M1?

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

image

alex-dukhno@Alexs-MacBook Projects/test-pro (master %) Β» /Volumes/Macintosh\ HD/usr/sbin/system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro16,1
      Processor Name: 8-Core Intel Core i9
      Processor Speed: 2,3 GHz
      Number of Processors: 1
      Total Number of Cores: 8
      L2 Cache (per Core): 256 KB
      L3 Cache: 16 MB
      Hyper-Threading Technology: Enabled
      Memory: 16 GB
      System Firmware Version: 1554.80.3.0.0 (iBridge: 18.16.14346.0.0,0)
      Serial Number (system): C02DX15EMD6Q
      Hardware UUID: 13B60DC7-4A06-5A78-8A14-B5673CC5331D
      Provisioning UDID: 13B60DC7-4A06-5A78-8A14-B5673CC5331D
      Activation Lock Status: Enabled

alex-dukhno avatar Feb 20 '21 19:02 alex-dukhno

So the "scanner" example works fine, but the basic example that simply calls the parse_query() function crashes. Weird. Ultimately, that's what the scanner example does too.

I can't re-create this locally on my MacBook. Still looking...

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

what version of Rust are you using? I'm kinda stumped at the moment. There's gotta be some difference between our environments.

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

what version of Rust are you using? I'm kinda stumped at the moment. There's gotta be some difference between our environments.

rustc -V                                                                                                                                                                                (main)isomorphicdb
rustc 1.50.0 (cb75ad5db 2021-02-10)

Ok, so I run the following experiment.

  1. I copied the scanner example into my project and run it - it fails with sigfault.
  2. I copied my project code instead of scanner code it worked out ...

I suppose the difference somewhere in project configuration ...

alex-dukhno avatar Feb 20 '21 19:02 alex-dukhno

can you tar up your example project that fails and post it here? or email it to me: eebbrr @ gmail dot com

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

I was on rustc 1.49.0 (e1884a8e3 2020-12-29) -- just upgraded to 1.50.0 and am rebuilding everything.

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

Your project works for me:

ξ‚° cargo run
    Updating crates.io index
  Downloaded libloading v0.7.0
  Downloaded clang-sys v1.1.1
  Downloaded 2 crates (62.8 KB) in 0.61s
...
   Compiling test-pro v0.1.0 (/Users/e_ridge/Downloads/test-pro)
warning: unused variable: `i`
 --> src/main.rs:7:10
  |
7 |     for (i, stmt) in scanner.into_iter().enumerate() {
  |          ^ help: if this is intentional, prefix it with an underscore: `_i`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 49.84s
     Running `target/debug/test-pro`
true
{
  "SelectStmt": {
    "targetList": [
      {
        "ResTarget": {
          "val": {
            "A_Const": {
              "val": {
                "int": 1
              }
            }
          }
        }
      }
    ],
    "limitOption": "LIMIT_OPTION_COUNT",
    "op": "SETOP_NONE",
    "all": false
  }
}

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

(oh, and this is with rustc 1.50.0 (cb75ad5db 2021-02-10))

eeeebbbbrrrr avatar Feb 20 '21 19:02 eeeebbbbrrrr

This fixes the sigfault in my project

diff --git Cargo.toml Cargo.toml
index 5eed888..61b715c 100644
--- Cargo.toml
+++ Cargo.toml
@@ -5,6 +5,6 @@ authors = ["Alex Dukhno <[email protected]>"]
 edition = "2018"

 [dependencies]
-postgres-parser = "0.2"
+postgres-parser = { path = "../postgres-parser" }
 serde = { version = "1.0.123", features = ["derive"] }
 serde_json = "1.0.62"

Is this possible because building parser locally is different from building and compiling it from crates.io? is it because of build.rs ?

alex-dukhno avatar Feb 20 '21 19:02 alex-dukhno

wel, that's interesting. I used it from crates.io too. And my private project that uses it builds it from crates.io w/o any problems.

What does cargo tree say? The published version is 0.2.1 -- is that what you have from crates.io?

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

cargo tree                                                                                                                                                                                     134 ↡
test-pro v0.1.0 (/Users/alex-dukhno/Projects/test-pro)
β”œβ”€β”€ postgres-parser v0.2.1
β”‚   β”œβ”€β”€ lazy_static v1.4.0
β”‚   └── serde v1.0.123
β”‚       └── serde_derive v1.0.123 (proc-macro)
β”‚           β”œβ”€β”€ proc-macro2 v1.0.24
β”‚           β”‚   └── unicode-xid v0.2.1
β”‚           β”œβ”€β”€ quote v1.0.9
β”‚           β”‚   └── proc-macro2 v1.0.24 (*)
β”‚           └── syn v1.0.60
β”‚               β”œβ”€β”€ proc-macro2 v1.0.24 (*)
β”‚               β”œβ”€β”€ quote v1.0.9 (*)
β”‚               └── unicode-xid v0.2.1
β”‚   [build-dependencies]
β”‚   β”œβ”€β”€ bindgen v0.57.0
β”‚   β”‚   β”œβ”€β”€ bitflags v1.2.1
β”‚   β”‚   β”œβ”€β”€ cexpr v0.4.0
β”‚   β”‚   β”‚   └── nom v5.1.2
β”‚   β”‚   β”‚       └── memchr v2.3.4
β”‚   β”‚   β”‚       [build-dependencies]
β”‚   β”‚   β”‚       └── version_check v0.9.2
β”‚   β”‚   β”œβ”€β”€ clang-sys v1.1.1
β”‚   β”‚   β”‚   β”œβ”€β”€ glob v0.3.0
β”‚   β”‚   β”‚   β”œβ”€β”€ libc v0.2.86
β”‚   β”‚   β”‚   └── libloading v0.7.0
β”‚   β”‚   β”‚       └── cfg-if v1.0.0
β”‚   β”‚   β”‚   [build-dependencies]
β”‚   β”‚   β”‚   └── glob v0.3.0
β”‚   β”‚   β”œβ”€β”€ clap v2.33.3
β”‚   β”‚   β”‚   β”œβ”€β”€ ansi_term v0.11.0
β”‚   β”‚   β”‚   β”œβ”€β”€ atty v0.2.14
β”‚   β”‚   β”‚   β”‚   └── libc v0.2.86
β”‚   β”‚   β”‚   β”œβ”€β”€ bitflags v1.2.1
β”‚   β”‚   β”‚   β”œβ”€β”€ strsim v0.8.0
β”‚   β”‚   β”‚   β”œβ”€β”€ textwrap v0.11.0
β”‚   β”‚   β”‚   β”‚   └── unicode-width v0.1.8
β”‚   β”‚   β”‚   β”œβ”€β”€ unicode-width v0.1.8
β”‚   β”‚   β”‚   └── vec_map v0.8.2
β”‚   β”‚   β”œβ”€β”€ env_logger v0.8.3
β”‚   β”‚   β”‚   β”œβ”€β”€ atty v0.2.14 (*)
β”‚   β”‚   β”‚   β”œβ”€β”€ humantime v2.1.0
β”‚   β”‚   β”‚   β”œβ”€β”€ log v0.4.14
β”‚   β”‚   β”‚   β”‚   └── cfg-if v1.0.0
β”‚   β”‚   β”‚   β”œβ”€β”€ regex v1.4.3
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ aho-corasick v0.7.15
β”‚   β”‚   β”‚   β”‚   β”‚   └── memchr v2.3.4
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ memchr v2.3.4
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ regex-syntax v0.6.22
β”‚   β”‚   β”‚   β”‚   └── thread_local v1.1.3
β”‚   β”‚   β”‚   β”‚       └── once_cell v1.5.2
β”‚   β”‚   β”‚   └── termcolor v1.1.2
β”‚   β”‚   β”œβ”€β”€ lazy_static v1.4.0
β”‚   β”‚   β”œβ”€β”€ lazycell v1.3.0
β”‚   β”‚   β”œβ”€β”€ log v0.4.14 (*)
β”‚   β”‚   β”œβ”€β”€ peeking_take_while v0.1.2
β”‚   β”‚   β”œβ”€β”€ proc-macro2 v1.0.24 (*)
β”‚   β”‚   β”œβ”€β”€ quote v1.0.9 (*)
β”‚   β”‚   β”œβ”€β”€ regex v1.4.3 (*)
β”‚   β”‚   β”œβ”€β”€ rustc-hash v1.1.0
β”‚   β”‚   β”œβ”€β”€ shlex v0.1.1
β”‚   β”‚   └── which v3.1.1
β”‚   β”‚       └── libc v0.2.86
β”‚   β”œβ”€β”€ num_cpus v1.13.0
β”‚   β”‚   └── libc v0.2.86
β”‚   β”œβ”€β”€ proc-macro2 v1.0.24 (*)
β”‚   β”œβ”€β”€ quote v1.0.9 (*)
β”‚   └── syn v1.0.60 (*)
β”œβ”€β”€ serde v1.0.123 (*)
└── serde_json v1.0.62
    β”œβ”€β”€ itoa v0.4.7
    β”œβ”€β”€ ryu v1.0.5
    └── serde v1.0.123 (*)

Weird question, maybe because it is night here 🀦 , I have postgres installed locally could it cause some problem?

alex-dukhno avatar Feb 20 '21 20:02 alex-dukhno

I have postgres installed locally could it cause some problem?

Naw. I do too -- 6 different versions!

postgres-parser downloads it, configures, and compiles it, via build.rs, all in the "target" directory. Which for a crates.io downloaded package is in its ~/.cargo/registry directory.

I've just removed my ~/.cargo/registry directory and am trying to build/run your test project again. I'm really stumped.

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

I've just removed my ~/.cargo/registry directory and am trying to build/run your test project again. I'm really stumped.

Yeah, that worked fine too. I'm clueless at the moment. 😒

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

Ok, I will debug it with lldb tomorrow. I hope I get something useful. Thanks for the help

alex-dukhno avatar Feb 20 '21 20:02 alex-dukhno

May you can try removing your ~/.cargo/registry directory, doing a cargo clean, and see what happens?

This is definitely weird.

What version of clang do you have? Mine is:

clang version 10.0.0 
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

Which apparently I must have installed via brew.

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

May you can try removing your ~/.cargo/registry directory, doing a cargo clean, and see what happens?

I did and got the same

alex-dukhno@Alexs-MacBook Downloads/test-pro (master %) Β» rm -rf ~/.cargo/registry
alex-dukhno@Alexs-MacBook Downloads/test-pro (master %) Β» cargo run
...
warning: unused variable: `i`
 --> src/main.rs:7:10
  |
7 |     for (i, stmt) in scanner.into_iter().enumerate() {
  |          ^ help: if this is intentional, prefix it with an underscore: `_i`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 49.71s
     Running `target/debug/test-pro`
true
[1]    65718 segmentation fault  cargo run

What version of clang do you have? Mine is:

clang version 10.0.0 
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

Which apparently I must have installed via brew.

I've installed llvm today via brew

alex-dukhno@Alexs-MacBook Downloads/test-pro (master %) Β» clang -v                                                                                                                                                                                      139 ↡
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

alex-dukhno avatar Feb 20 '21 20:02 alex-dukhno

well, actually, that's the clang installed by XCode.

I wonder if that's a thing... There's a "known issue" with that, and I wonder if that's what we're seeing: https://github.com/zombodb/postgres-parser#known-issues

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

Then I am wondering why example works fine? How is it possible that in directly cloned repo another clang is used?

alex-dukhno avatar Feb 20 '21 20:02 alex-dukhno

Yeah. I’m wondering that too. I dunno. Soooo weird.

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

I wonder if it has something to do with postgres-parser's published Cargo.lock file. It appears to be a little out of date:

diff --git a/Cargo.lock b/Cargo.lock
index 3a93997..e8886be 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -75,9 +75,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
 [[package]]
 name = "clang-sys"
-version = "1.0.3"
+version = "1.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c"
+checksum = "f54d78e30b388d4815220c8dd03fea5656b6c6d32adb59e89061552a102f8da1"
 dependencies = [
  "glob",
  "libc",
@@ -101,9 +101,9 @@ dependencies = [
 
 [[package]]
 name = "env_logger"
-version = "0.8.2"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
+checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f"
 dependencies = [
  "atty",
  "humantime",
@@ -159,9 +159,9 @@ checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
 
 [[package]]
 name = "libloading"
-version = "0.6.7"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883"
+checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a"
 dependencies = [
  "cfg-if",
  "winapi",
@@ -239,9 +239,9 @@ dependencies = [
 
 [[package]]
 name = "quote"
-version = "1.0.8"
+version = "1.0.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
+checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
 dependencies = [
  "proc-macro2",
 ]

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

let me update all the dependencies and Cargo.lock and publish v0.2.3 and lets see what happens.

eeeebbbbrrrr avatar Feb 20 '21 20:02 eeeebbbbrrrr

alex-dukhno@Alexs-MacBook Downloads/test-pro (master %) Β»source ~/.zshenv
alex-dukhno@Alexs-MacBook Downloads/test-pro (master %) Β»clang -v
clang version 11.1.0
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
alex-dukhno@Alexs-MacBook Downloads/test-pro (master %) Β» cargo clean
alex-dukhno@Alexs-MacBook Downloads/test-pro (master %) Β» cargo run

and it works ...

warning: unused variable: `i`
 --> src/main.rs:7:10
  |
7 |     for (i, stmt) in scanner.into_iter().enumerate() {
  |          ^ help: if this is intentional, prefix it with an underscore: `_i`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 3m 18s
     Running `target/debug/test-pro`
true
{
  "SelectStmt": {
    "targetList": [
      {
        "ResTarget": {
          "val": {
            "A_Const": {
              "val": {
                "int": 1
              }
            }
          }
        }
      }
    ],
    "limitOption": "LIMIT_OPTION_COUNT",
    "op": "SETOP_NONE",
    "all": false
  }
}

alex-dukhno avatar Feb 20 '21 20:02 alex-dukhno