diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f7a02a4edf1..33a75918393 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,18 +15,10 @@ concurrency: cancel-in-progress: true env: - CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit NON_WASM_PACKAGES: >- -p rustpython-common -p rustpython-compiler-core - -p rustpython-compiler - -p rustpython-codegen -p rustpython-parser - -p rustpython-vm - -p rustpython-stdlib - -p rustpython-jit - -p rustpython-derive - -p rustpython PLATFORM_INDEPENDENT_TESTS: >- test_argparse test_array @@ -237,80 +229,80 @@ jobs: with: command: check - snippets_cpython: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} - needs: lalrpop - env: - RUST_BACKTRACE: full - name: Run snippets and cpython tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: Cache generated parser - uses: actions/cache@v3 - with: - path: compiler/parser/python.rs - key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} - - - uses: dtolnay/rust-toolchain@stable - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: Set up the Windows environment - shell: bash - run: | - choco install llvm openssl - echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV - if: runner.os == 'Windows' - - name: Set up the Mac environment - run: brew install autoconf automake libtool openssl@3 - if: runner.os == 'macOS' - - - uses: Swatinem/rust-cache@v2 - - name: build rustpython - run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }} - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: run snippets - run: python -m pip install -r requirements.txt && pytest -v - working-directory: ./extra_tests - - if: runner.os == 'Linux' - name: run cpython platform-independent tests - run: - target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} - - if: runner.os != 'Windows' - name: run cpython platform-dependent tests - run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} - - if: runner.os == 'Windows' - name: run cpython platform-dependent tests (windows partial - fixme) - run: - target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} - test_glob - test_importlib - test_io - test_iter - test_os - test_pathlib - test_posixpath - test_shutil - test_venv - - if: runner.os != 'Windows' - name: check that --install-pip succeeds - run: | - mkdir site-packages - target/release/rustpython --install-pip ensurepip --user - - if: runner.os != 'Windows' - name: Check that ensurepip succeeds. - run: | - target/release/rustpython -m ensurepip - target/release/rustpython -c "import pip" - - name: Check whats_left is not broken - run: python -I whats_left.py +# snippets_cpython: +# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} +# needs: lalrpop +# env: +# RUST_BACKTRACE: full +# name: Run snippets and cpython tests +# runs-on: ${{ matrix.os }} +# strategy: +# matrix: +# os: [macos-latest, ubuntu-latest, windows-latest] +# fail-fast: false +# steps: +# - uses: actions/checkout@v3 +# - name: Cache generated parser +# uses: actions/cache@v3 +# with: +# path: compiler/parser/python.rs +# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} +# +# - uses: dtolnay/rust-toolchain@stable +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.11" +# - name: Set up the Windows environment +# shell: bash +# run: | +# choco install llvm openssl +# echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV +# if: runner.os == 'Windows' +# - name: Set up the Mac environment +# run: brew install autoconf automake libtool openssl@3 +# if: runner.os == 'macOS' +# +# - uses: Swatinem/rust-cache@v2 +# - name: build rustpython +# run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }} +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.11" +# - name: run snippets +# run: python -m pip install -r requirements.txt && pytest -v +# working-directory: ./extra_tests +# - if: runner.os == 'Linux' +# name: run cpython platform-independent tests +# run: +# target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} +# - if: runner.os != 'Windows' +# name: run cpython platform-dependent tests +# run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} +# - if: runner.os == 'Windows' +# name: run cpython platform-dependent tests (windows partial - fixme) +# run: +# target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} +# test_glob +# test_importlib +# test_io +# test_iter +# test_os +# test_pathlib +# test_posixpath +# test_shutil +# test_venv +# - if: runner.os != 'Windows' +# name: check that --install-pip succeeds +# run: | +# mkdir site-packages +# target/release/rustpython --install-pip ensurepip --user +# - if: runner.os != 'Windows' +# name: Check that ensurepip succeeds. +# run: | +# target/release/rustpython -m ensurepip +# target/release/rustpython -c "import pip" +# - name: Check whats_left is not broken +# run: python -I whats_left.py lalrpop: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} @@ -361,8 +353,8 @@ jobs: components: rustfmt, clippy - name: run rustfmt run: cargo fmt --all -- --check - - name: run clippy on wasm - run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings +# - name: run clippy on wasm +# run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings - uses: actions/setup-python@v4 with: python-version: "3.11" @@ -397,86 +389,84 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run tests under miri - # miri-ignore-leaks because the type-object circular reference means that there will always be - # a memory leak, at least until we have proper cyclic gc - run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test - - wasm: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} - name: Check the WASM package and demo - needs: lalrpop - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Cache generated parser - uses: actions/cache@v3 - with: - path: compiler/parser/python.rs - key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} - - uses: dtolnay/rust-toolchain@stable - - - uses: Swatinem/rust-cache@v2 - - name: install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: install geckodriver - run: | - wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz - mkdir geckodriver - tar -xzf geckodriver-v0.30.0-linux64.tar.gz -C geckodriver - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - run: python -m pip install -r requirements.txt - working-directory: ./wasm/tests - - uses: actions/setup-node@v3 - - name: run test - run: | - export PATH=$PATH:`pwd`/../../geckodriver - npm install - npm run test - env: - NODE_OPTIONS: "--openssl-legacy-provider" - working-directory: ./wasm/demo - - name: build notebook demo - if: github.ref == 'refs/heads/release' - run: | - npm install - npm run dist - mv dist ../demo/dist/notebook - env: - NODE_OPTIONS: "--openssl-legacy-provider" - working-directory: ./wasm/notebook - - name: Deploy demo to Github Pages - if: success() && github.ref == 'refs/heads/release' - uses: peaceiris/actions-gh-pages@v2 - env: - ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} - PUBLISH_DIR: ./wasm/demo/dist - EXTERNAL_REPOSITORY: RustPython/demo - PUBLISH_BRANCH: master - - wasm-wasi: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} - name: Run snippets and cpython tests on wasm-wasi - needs: lalrpop - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Cache generated parser - uses: actions/cache@v3 - with: - path: compiler/parser/python.rs - key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} - - uses: dtolnay/rust-toolchain@stable - with: - target: wasm32-wasi - - - uses: Swatinem/rust-cache@v2 - - name: Setup Wasmer - uses: wasmerio/setup-wasmer@v2 - - name: Install clang - run: sudo apt-get update && sudo apt-get install clang -y - - name: build rustpython - run: cargo build --release --target wasm32-wasi --features freeze-stdlib,stdlib --verbose - - name: run snippets - run: wasmer run --dir . target/wasm32-wasi/release/rustpython.wasm -- extra_tests/snippets/stdlib_random.py + run: cargo +nightly miri test -p rustpython-parser -- miri_test + +# wasm: +# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} +# name: Check the WASM package and demo +# needs: lalrpop +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Cache generated parser +# uses: actions/cache@v3 +# with: +# path: compiler/parser/python.rs +# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} +# - uses: dtolnay/rust-toolchain@stable +# +# - uses: Swatinem/rust-cache@v2 +# - name: install wasm-pack +# run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh +# - name: install geckodriver +# run: | +# wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz +# mkdir geckodriver +# tar -xzf geckodriver-v0.30.0-linux64.tar.gz -C geckodriver +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.11" +# - run: python -m pip install -r requirements.txt +# working-directory: ./wasm/tests +# - uses: actions/setup-node@v3 +# - name: run test +# run: | +# export PATH=$PATH:`pwd`/../../geckodriver +# npm install +# npm run test +# env: +# NODE_OPTIONS: "--openssl-legacy-provider" +# working-directory: ./wasm/demo +# - name: build notebook demo +# if: github.ref == 'refs/heads/release' +# run: | +# npm install +# npm run dist +# mv dist ../demo/dist/notebook +# env: +# NODE_OPTIONS: "--openssl-legacy-provider" +# working-directory: ./wasm/notebook +# - name: Deploy demo to Github Pages +# if: success() && github.ref == 'refs/heads/release' +# uses: peaceiris/actions-gh-pages@v2 +# env: +# ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} +# PUBLISH_DIR: ./wasm/demo/dist +# EXTERNAL_REPOSITORY: RustPython/demo +# PUBLISH_BRANCH: master +# +# wasm-wasi: +# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} +# name: Run snippets and cpython tests on wasm-wasi +# needs: lalrpop +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Cache generated parser +# uses: actions/cache@v3 +# with: +# path: compiler/parser/python.rs +# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} +# - uses: dtolnay/rust-toolchain@stable +# with: +# target: wasm32-wasi +# +# - uses: Swatinem/rust-cache@v2 +# - name: Setup Wasmer +# uses: wasmerio/setup-wasmer@v2 +# - name: Install clang +# run: sudo apt-get update && sudo apt-get install clang -y +# - name: build rustpython +# run: cargo build --release --target wasm32-wasi --features freeze-stdlib,stdlib --verbose +# - name: run snippets +# run: wasmer run --dir . target/wasm32-wasi/release/rustpython.wasm -- extra_tests/snippets/stdlib_random.py diff --git a/Cargo.lock b/Cargo.lock index 42c60e0f10a..1424dfb4203 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,12 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + [[package]] name = "ascii-canvas" version = "3.0.0" @@ -209,6 +215,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + [[package]] name = "indexmap" version = "1.9.2" @@ -307,6 +319,36 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + [[package]] name = "libc" version = "0.2.141" @@ -353,6 +395,12 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + [[package]] name = "memchr" version = "2.5.0" @@ -496,6 +544,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -520,12 +574,30 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", "rand_core", ] @@ -534,6 +606,9 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] name = "redox_syscall" @@ -616,6 +691,32 @@ dependencies = [ "ruff_text_size", ] +[[package]] +name = "rustpython-common" +version = "0.2.0" +dependencies = [ + "ascii", + "bitflags", + "bstr", + "cfg-if", + "hexf-parse", + "itertools", + "lexical-parse-float", + "libc", + "lock_api", + "num-bigint", + "num-complex", + "num-traits", + "once_cell", + "parking_lot", + "radium", + "rand", + "siphasher", + "unic-ucd-category", + "volatile", + "widestring", +] + [[package]] name = "rustpython-compiler-core" version = "0.2.0" @@ -879,6 +980,18 @@ dependencies = [ "unic-ucd-version", ] +[[package]] +name = "unic-ucd-category" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8d4591f5fcfe1bd4453baaf803c40e1b1e69ff8455c47620440b46efef91c0" +dependencies = [ + "matches", + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + [[package]] name = "unic-ucd-ident" version = "0.9.0" @@ -925,12 +1038,24 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "volatile" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8e76fae08f03f96e166d2dfda232190638c10e0383841252416f9cfe2ae60e6" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 5caf902530e..39ec98e2e7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ [workspace] resolver = "2" members = [ - "ruff_text_size", "compiler/ast", "compiler/parser" + "ruff_text_size", "compiler/ast", "compiler/core", "compiler/parser", "common" ] [workspace.dependencies] diff --git a/compiler/ast/asdl_rs.py b/compiler/ast/asdl_rs.py index b217e629a7c..c1d8904b0d4 100755 --- a/compiler/ast/asdl_rs.py +++ b/compiler/ast/asdl_rs.py @@ -311,7 +311,7 @@ def visitModule(self, mod, depth): depth, ) self.emit( - "Ok(Located { custom: folder.map_user(node.custom)?, location: node.location, end_location: node.end_location, node: f(folder, node.node)? })", + "Ok(Located { custom: folder.map_user(node.custom)?, range: node.range, node: f(folder, node.node)? })", depth + 1, ) self.emit("}", depth) @@ -649,7 +649,7 @@ def write_ast_def(mod, typeinfo, f): #![allow(clippy::derive_partial_eq_without_eq)] pub use crate::constant::*; - pub use crate::Location; + pub use ruff_text_size::{TextSize, TextRange}; type Ident = String; \n @@ -661,15 +661,61 @@ def write_ast_def(mod, typeinfo, f): textwrap.dedent( """ pub struct Located { - pub location: Location, - pub end_location: Option, + pub range: TextRange, pub custom: U, pub node: T, } impl Located { - pub fn new(location: Location, end_location: Location, node: T) -> Self { - Self { location, end_location: Some(end_location), custom: (), node } + pub fn new(start: TextSize, end: TextSize, node: T) -> Self { + Self { range: TextRange::new(start, end), custom: (), node } + } + + /// Creates a new node that spans the position specified by `range`. + pub fn with_range(node: T, range: TextRange) -> Self { + Self { + range, + custom: (), + node, + } + } + + /// Returns the absolute start position of the node from the beginning of the document. + #[inline] + pub const fn start(&self) -> TextSize { + self.range.start() + } + + /// Returns the node + #[inline] + pub fn node(&self) -> &T { + &self.node + } + + /// Consumes self and returns the node. + #[inline] + pub fn into_node(self) -> T { + self.node + } + + /// Returns the `range` of the node. The range offsets are absolute to the start of the document. + #[inline] + pub const fn range(&self) -> TextRange { + self.range + } + + /// Returns the absolute position at which the node ends in the source document. + #[inline] + pub const fn end(&self) -> TextSize { + self.range.end() + } + } + + impl std::ops::Deref for Located { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.node } } \n diff --git a/compiler/ast/src/ast_gen.rs b/compiler/ast/src/ast_gen.rs index bbf84318158..d5fd6ece7d0 100644 --- a/compiler/ast/src/ast_gen.rs +++ b/compiler/ast/src/ast_gen.rs @@ -3,8 +3,7 @@ #![allow(clippy::derive_partial_eq_without_eq)] pub use crate::constant::*; -use ruff_text_size::{TextRange, TextSize}; -use std::ops::Deref; +pub use ruff_text_size::{TextRange, TextSize}; type Ident = String; @@ -15,26 +14,20 @@ pub struct Located { pub node: T, } -impl Located { - pub fn new(location: TextSize, end_location: TextSize, node: T) -> Self - where - U: Default, - { +impl Located { + pub fn new(start: TextSize, end: TextSize, node: T) -> Self { Self { - custom: U::default(), - range: TextRange::new(location, end_location), + range: TextRange::new(start, end), + custom: (), node, } } /// Creates a new node that spans the position specified by `range`. - pub fn with_range(node: T, range: TextRange) -> Self - where - U: Default, - { + pub fn with_range(node: T, range: TextRange) -> Self { Self { range, - custom: U::default(), + custom: (), node, } } @@ -45,11 +38,6 @@ impl Located { self.range.start() } - #[inline] - pub fn custom(&self) -> &U { - &self.custom - } - /// Returns the node #[inline] pub fn node(&self) -> &T { @@ -62,11 +50,6 @@ impl Located { self.node } - #[inline] - pub fn into_custom(self) -> U { - self.custom - } - /// Returns the `range` of the node. The range offsets are absolute to the start of the document. #[inline] pub const fn range(&self) -> TextRange { @@ -80,7 +63,7 @@ impl Located { } } -impl Deref for Located { +impl std::ops::Deref for Located { type Target = T; fn deref(&self) -> &Self::Target { diff --git a/compiler/ast/src/constant.rs b/compiler/ast/src/constant.rs index fee791ae411..a811ccf30ec 100644 --- a/compiler/ast/src/constant.rs +++ b/compiler/ast/src/constant.rs @@ -132,7 +132,6 @@ impl crate::fold::Fold for ConstantOptimizer { #[cfg(test)] mod tests { use super::*; - use ruff_text_size::TextRange; #[cfg(feature = "constant-optimization")] #[test]